// @license http://opensource.org/licenses/MIT (function(){if("performance"in window||(window.performance={}),Date.now=Date.now||function(){return new Date().getTime()},!("now"in window.performance)){var i=Date.now();performance.timing&&performance.timing.navigationStart&&(i=performance.timing.navigationStart),window.performance.now=function(){return Date.now()-i}}})();window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach);Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);Element.prototype.closest||(Element.prototype.closest=function(i){var e=this;do{if(e.matches(i))return e;e=e.parentElement||e.parentNode}while(e!==null&&e.nodeType===1);return null});window.getUrlParameter=function(i){i=i.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+i+"=([^&#]*)"),t=e.exec(location.search);return t===null?!1:decodeURIComponent(t[1].replace(/\+/g," "))};window.elementIsVisible=function(i){return!!(i.offsetWidth||i.offsetHeight||i.getClientRects().length)};window.scrollToElement=function(i,e=0){e===0?i.scrollIntoView({behavior:"smooth"}):window.scrollTo({top:i.getBoundingClientRect().top-document.body.getBoundingClientRect().top-e,behavior:"smooth"})};window._debounce=function(i,e,t){var s;return function(){var r=this,n=arguments,a=function(){s=null,t||i.apply(r,n)},o=t&&!s;clearTimeout(s),s=setTimeout(a,e),o&&i.apply(r,n)}};window.isElementVisible=function(i){let e=i.getBoundingClientRect();return e.top>0&&e.left>=0&&e.right<=window.innerWidth&&e.bottom<=window.innerHeight};(function(){window.modalZIndex=9998,window.modals={open:0,list:{}},window.Modal=function(i){this.name=i.id,this.modal=i,this.handleActions(),this.handleClose()},window.Modal.prototype={open:function(){let i=this;this.modal.style.display="block",this.modal.classList.add("modal-enter"),setTimeout(function(){i.modal.classList.remove("modal-enter")},100),this.modal.setAttribute("data-open",!0),document.body.style.overflow="hidden",window.modals.open++,window.player&&window.player.pause(),window.dispatchEvent(new CustomEvent("modal:open",{detail:{modal:this.name}}))},close:function(){let i=this;this.modal.classList.add("modal-enter"),setTimeout(function(){i.modal.classList.remove("modal-enter"),i.modal.style.display="none"},100),this.modal.removeAttribute("data-open"),window.modals.open--,window.modals.open===0&&(document.body.style.overflow="auto",window.player&&(window.player.play(),!window.isFullscreen&&!window.App.firstPlay&&toggleFullscreenVideo())),window.dispatchEvent(new CustomEvent("modal:close",{detail:{modal:this.name}}))},isOpen:function(){return this.modal.getAttribute("data-open")},handleActions:function(){let i=this;this.modal.querySelectorAll("[data-modal-action]").forEach(e=>{e.addEventListener("click",function(t){let s=e.hash;s.length&&(t.preventDefault(),s!=="#close"&&openModal(s.substr(1)),setTimeout(function(){i.close()},150))})})},handleClose:function(){let i=this;this.modal.querySelectorAll("[data-modal-close]").forEach(function(e){e.addEventListener("click",function(t){t.preventDefault(),i.close()})})}},window.getModal=function(i){if(!window.modals.list.hasOwnProperty(i)){let e=Array.prototype.slice.call(document.querySelectorAll("[data-modal]")).filter(function(t){return t.id===i+"Modal"});e.length&&(window.modals.list[i]=new Modal(e[0]))}return window.modals.list[i]},window.openModal=function(i){let e=window.getModal(i);e.isOpen()||e.open(),e.modal.style.zIndex=window.modalZIndex,window.modalZIndex++},window.closeModal=function(i){let e=window.getModal(i);e.close(),window.modalZIndex--,e.modal.style.zIndex=window.modalZIndex}})();window.Dropdown=function(i){this.dropdown=i,this.dropdownContent=i.querySelector("[data-dropdown-content]"),this.handleToggle(),this.handleClickOutside()};Dropdown.prototype={open:function(){this.dropdown.classList.add("open"),this.dropdownContent.classList.add("open")},close:function(){this.dropdown.classList.remove("open"),this.dropdownContent.classList.remove("open")},isOpen(){return this.dropdown.classList.contains("open")},handleToggle(){let i=this;this.dropdown.querySelector("[data-dropdown-toggle]").addEventListener("click",function(t){t.preventDefault(),i.isOpen()?i.close():i.open()})},handleClickOutside(){let i=this;document.addEventListener("click",function(e){if(!i.isOpen())return;i.dropdown;let t=e.target;if(t.closest("[data-dropdown-content]"))return i.close();do{if(t==i.dropdown)return;t=t.parentNode}while(t);i.close()})}};document.querySelectorAll("[data-dropdown]").forEach(function(i){new Dropdown(i)});(function(){document.querySelectorAll("[data-form]").forEach(function(i){let e=i.querySelector("form"),t=i.querySelector("[data-form-error]"),s=i.querySelector("[data-form-success]");!e||!t||!s||e.addEventListener("submit",function(r){r.preventDefault();const n=e.querySelector('button[type="submit"], input[type="submit"]');if(n){const u=n.innerHTML,c=n.style.backgroundColor,p=n.style.cursor;n.setAttribute("data-original-text",u),n.setAttribute("data-original-bg-color",c),n.setAttribute("data-original-cursor",p),n.innerHTML="⏳ Sending...",n.style.backgroundColor="#888888",n.style.cursor="wait",n.style.opacity="0.7",n.disabled=!0}var a=i.querySelector("#recaptchaError");a&&(a.innerHTML="",a.style.display="none");var a=i.querySelector("#recaptchaError");a&&(a.innerHTML="",a.style.display="none");var o=new XMLHttpRequest;o.onreadystatechange=function(){if(this.readyState!==XMLHttpRequest.DONE)return;const u=e.querySelector('button[type="submit"], input[type="submit"]');if(u){const p=u.getAttribute("data-original-text");p&&(u.innerHTML=p);const y=u.getAttribute("data-original-bg-color"),T=u.getAttribute("data-original-cursor");u.style.backgroundColor=y||"",u.style.cursor=T||"",u.style.opacity="",u.disabled=!1}if(this.status===422){let p=JSON.parse(this.response);e.querySelectorAll("[data-form-field-error]").forEach(function(y){let T=y.id.slice(0,-5);y.innerHTML=p.hasOwnProperty(T)?p[T]:"",y.style.display=p.hasOwnProperty(T)?"block":"none"});var c=i.querySelector("#recaptchaError");c&&p.hasOwnProperty("recaptcha")&&(c.innerHTML=p.recaptcha,c.style.display="block",typeof grecaptcha<"u"&&grecaptcha.reset());return}this.status===200?(e.style.display="none",t.style.display="none",s.style.display="block"):(t.style.display="block",s.style.display="none")},o.open("POST",e.action,!0),o.send(new FormData(e))})})})();(function(){if(getUrlParameter("exit","1")==="0"||App.exitPopup===null){window.showExitPopup=function(){};return}let i=!1;if(window.showExitPopup=function(t){if(!t||t.type!=="mouseleave"||t.clientY<=0){let r=window.getModal("transcript");!i&&(!r||r&&!r.isOpen())&&(openModal(App.exitPopup+"ExitPopup"),i=!0),App.merchant!=="clickbank"&&r&&r.isOpen()&&window.getModal("transcriptExitPopup")&&openModal("transcriptExitPopup")}},App.softExitPopup){let t=0;document.addEventListener("mousemove",function(s){t=s.clientY}),document.querySelector("html").addEventListener("mouseleave",function(s){t<=0&&window.showExitPopup(s)})}if(App.hardExitPopup){let t=!1,s=document.getElementsByTagName("A");for(var e=0;e=i.length?{done:!0}:{done:!1,value:i[s++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jy(i,e){if(i){if(typeof i=="string")return xc(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return xc(i,e)}}function xc(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t=400&&r.statusCode<=599){var a=n;if(t)if(r_.TextDecoder){var o=a_(r.headers&&r.headers["content-type"]);try{a=new TextDecoder(o).decode(n)}catch{}}else a=String.fromCharCode.apply(null,new Uint8Array(n));e({cause:a});return}e(null,n)}};function a_(i){return i===void 0&&(i=""),i.toLowerCase().split(";").reduce(function(e,t){var s=t.split("="),r=s[0],n=s[1];return r.trim()==="charset"?n.trim():e},"utf-8")}var o_=n_,gh=ra,l_=Gy,u_=Xy,yh=e_,c_=s_;Ee.httpHandler=o_;Ee.requestInterceptorsStorage=new yh;Ee.responseInterceptorsStorage=new yh;Ee.retryManager=new c_;/** * @license * slighly modified parse-headers 2.0.2 * Copyright (c) 2014 David Björklund * Available under the MIT license * */var d_=function(e){var t={};return e&&e.trim().split(` `).forEach(function(s){var r=s.indexOf(":"),n=s.slice(0,r).trim().toLowerCase(),a=s.slice(r+1).trim();typeof t[n]>"u"?t[n]=a:Array.isArray(t[n])?t[n].push(a):t[n]=[t[n],a]}),t};vl.exports=Ee;vl.exports.default=Ee;Ee.XMLHttpRequest=gh.XMLHttpRequest||m_;Ee.XDomainRequest="withCredentials"in new Ee.XMLHttpRequest?Ee.XMLHttpRequest:gh.XDomainRequest;h_(["get","put","post","patch","head","delete"],function(i){Ee[i==="delete"?"del":i]=function(e,t,s){return t=_h(e,t,s),t.method=i.toUpperCase(),Sl(t)}});function h_(i,e){for(var t=0;t"u")throw new Error("callback argument missing");if(i.requestType&&Ee.requestInterceptorsStorage.getIsEnabled()){var e={uri:i.uri||i.url,headers:i.headers||{},body:i.body,metadata:i.metadata||{},retry:i.retry,timeout:i.timeout},t=Ee.requestInterceptorsStorage.execute(i.requestType,e);i.uri=t.uri,i.headers=t.headers,i.body=t.body,i.metadata=t.metadata,i.retry=t.retry,i.timeout=t.timeout}var s=!1,r=function(R,q,F){s||(s=!0,i.callback(R,q,F))};function n(){c.readyState===4&&!Ee.responseInterceptorsStorage.getIsEnabled()&&setTimeout(u,0)}function a(){var O=void 0;if(c.response?O=c.response:O=c.responseText||p_(c),D)try{O=JSON.parse(O)}catch{}return O}function o(O){if(clearTimeout(P),clearTimeout(i.retryTimeout),O instanceof Error||(O=new Error(""+(O||"Unknown XMLHttpRequest Error"))),O.statusCode=0,!y&&Ee.retryManager.getIsEnabled()&&i.retry&&i.retry.shouldRetry()){i.retryTimeout=setTimeout(function(){i.retry.moveToNextAttempt(),i.xhr=c,Sl(i)},i.retry.getCurrentFuzzedDelay());return}if(i.requestType&&Ee.responseInterceptorsStorage.getIsEnabled()){var R={headers:k.headers||{},body:k.body,responseUrl:c.responseURL,responseType:c.responseType},q=Ee.responseInterceptorsStorage.execute(i.requestType,R);k.body=q.body,k.headers=q.headers}return r(O,k)}function u(){if(!y){var O;clearTimeout(P),clearTimeout(i.retryTimeout),i.useXDR&&c.status===void 0?O=200:O=c.status===1223?204:c.status;var R=k,q=null;if(O!==0?(R={body:a(),statusCode:O,method:x,headers:{},url:T,rawRequest:c},c.getAllResponseHeaders&&(R.headers=d_(c.getAllResponseHeaders()))):q=new Error("Internal XMLHttpRequest Error"),i.requestType&&Ee.responseInterceptorsStorage.getIsEnabled()){var F={headers:R.headers||{},body:R.body,responseUrl:c.responseURL,responseType:c.responseType},$=Ee.responseInterceptorsStorage.execute(i.requestType,F);R.body=$.body,R.headers=$.headers}return r(q,R,R.body)}}var c=i.xhr||null;c||(i.cors||i.useXDR?c=new Ee.XDomainRequest:c=new Ee.XMLHttpRequest);var p,y,T=c.url=i.uri||i.url,x=c.method=i.method||"GET",S=i.body||i.data,_=c.headers=i.headers||{},A=!!i.sync,D=!1,P,k={body:void 0,headers:{},statusCode:0,method:x,url:T,rawRequest:c};if("json"in i&&i.json!==!1&&(D=!0,_.accept||_.Accept||(_.Accept="application/json"),x!=="GET"&&x!=="HEAD"&&(_["content-type"]||_["Content-Type"]||(_["Content-Type"]="application/json"),S=JSON.stringify(i.json===!0?S:i.json))),c.onreadystatechange=n,c.onload=u,c.onerror=o,c.onprogress=function(){},c.onabort=function(){y=!0,clearTimeout(i.retryTimeout)},c.ontimeout=o,c.open(x,T,!A,i.username,i.password),A||(c.withCredentials=!!i.withCredentials),!A&&i.timeout>0&&(P=setTimeout(function(){if(!y){y=!0,c.abort("timeout");var O=new Error("XMLHttpRequest timeout");O.code="ETIMEDOUT",o(O)}},i.timeout)),c.setRequestHeader)for(p in _)_.hasOwnProperty(p)&&c.setRequestHeader(p,_[p]);else if(i.headers&&!f_(i.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in i&&(c.responseType=i.responseType),"beforeSend"in i&&typeof i.beforeSend=="function"&&i.beforeSend(c),c.send(S||null),c}function p_(i){try{if(i.responseType==="document")return i.responseXML;var e=i.responseXML&&i.responseXML.documentElement.nodeName==="parsererror";if(i.responseType===""&&!e)return i.responseXML}catch{}return null}function m_(){}var g_=vl.exports;const Th=xr(g_);var bh={exports:{}},Ec=mh,xl=Object.create||function(){function i(){}return function(e){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return i.prototype=e,new i}}();function nt(i,e){this.name="ParsingError",this.code=i.code,this.message=e||i.message}nt.prototype=xl(Error.prototype);nt.prototype.constructor=nt;nt.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function El(i){function e(s,r,n,a){return(s|0)*3600+(r|0)*60+(n|0)+(a|0)/1e3}var t=i.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return t?t[3]?e(t[1],t[2],t[3].replace(":",""),t[4]):t[1]>59?e(t[1],t[2],0,t[4]):e(0,t[1],t[2],t[4]):null}function or(){this.values=xl(null)}or.prototype={set:function(i,e){!this.get(i)&&e!==""&&(this.values[i]=e)},get:function(i,e,t){return t?this.has(i)?this.values[i]:e[t]:this.has(i)?this.values[i]:e},has:function(i){return i in this.values},alt:function(i,e,t){for(var s=0;s=0&&e<=100)?(this.set(i,e),!0):!1}};function sr(i,e,t,s){var r=s?i.split(s):[i];for(var n in r)if(typeof r[n]=="string"){var a=r[n].split(t);if(a.length===2){var o=a[0].trim(),u=a[1].trim();e(o,u)}}}function y_(i,e,t){var s=i;function r(){var o=El(i);if(o===null)throw new nt(nt.Errors.BadTimeStamp,"Malformed timestamp: "+s);return i=i.replace(/^[^\sa-zA-Z-]+/,""),o}function n(o,u){var c=new or;sr(o,function(p,y){switch(p){case"region":for(var T=t.length-1;T>=0;T--)if(t[T].id===y){c.set(p,t[T].region);break}break;case"vertical":c.alt(p,y,["rl","lr"]);break;case"line":var x=y.split(","),S=x[0];c.integer(p,S),c.percent(p,S)&&c.set("snapToLines",!1),c.alt(p,S,["auto"]),x.length===2&&c.alt("lineAlign",x[1],["start","center","end"]);break;case"position":x=y.split(","),c.percent(p,x[0]),x.length===2&&c.alt("positionAlign",x[1],["start","center","end"]);break;case"size":c.percent(p,y);break;case"align":c.alt(p,y,["start","center","end","left","right"]);break}},/:/,/\s/),u.region=c.get("region",null),u.vertical=c.get("vertical","");try{u.line=c.get("line","auto")}catch{}u.lineAlign=c.get("lineAlign","start"),u.snapToLines=c.get("snapToLines",!0),u.size=c.get("size",100);try{u.align=c.get("align","center")}catch{u.align=c.get("align","middle")}try{u.position=c.get("position","auto")}catch{u.position=c.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},u.align)}u.positionAlign=c.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},u.align)}function a(){i=i.replace(/^\s+/,"")}if(a(),e.startTime=r(),a(),i.substr(0,3)!=="-->")throw new nt(nt.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+s);i=i.substr(3),a(),e.endTime=r(),a(),n(i,e)}var oo=Ec.createElement&&Ec.createElement("textarea"),__={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},Cc={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},T_={v:"title",lang:"lang"},wc={rt:"ruby"};function vh(i,e){function t(){if(!e)return null;function S(A){return e=e.substr(A.length),A}var _=e.match(/^([^<]*)(<[^>]*>?)?/);return S(_[1]?_[1]:_[2])}function s(S){return oo.innerHTML=S,S=oo.textContent,oo.textContent="",S}function r(S,_){return!wc[_.localName]||wc[_.localName]===S.localName}function n(S,_){var A=__[S];if(!A)return null;var D=i.document.createElement(A),P=T_[S];return P&&_&&(D[P]=_.trim()),D}for(var a=i.document.createElement("div"),o=a,u,c=[];(u=t())!==null;){if(u[0]==="<"){if(u[1]==="/"){c.length&&c[c.length-1]===u.substr(2).replace(">","")&&(c.pop(),o=o.parentNode);continue}var p=El(u.substr(1,u.length-2)),y;if(p){y=i.document.createProcessingInstruction("timestamp",p),o.appendChild(y);continue}var T=u.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!T||(y=n(T[1],T[3]),!y)||!r(o,y))continue;if(T[2]){var x=T[2].split(".");x.forEach(function(S){var _=/^bg_/.test(S),A=_?S.slice(3):S;if(Cc.hasOwnProperty(A)){var D=_?"background-color":"color",P=Cc[A];y.style[D]=P}}),y.className=x.join(" ")}c.push(T[1]),o.appendChild(y),o=y;continue}o.appendChild(i.document.createTextNode(s(u)))}return a}var Ac=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function b_(i){for(var e=0;e=t[0]&&i<=t[1])return!0}return!1}function v_(i){var e=[],t="",s;if(!i||!i.childNodes)return"ltr";function r(o,u){for(var c=u.childNodes.length-1;c>=0;c--)o.push(u.childNodes[c])}function n(o){if(!o||!o.length)return null;var u=o.pop(),c=u.textContent||u.innerText;if(c){var p=c.match(/^.*(\n|\r)/);return p?(o.length=0,p[0]):c}if(u.tagName==="ruby")return n(o);if(u.childNodes)return r(o,u),n(o)}for(r(e,i);t=n(e);)for(var a=0;a=0&&i.line<=100))return i.line;if(!i.track||!i.track.textTrackList||!i.track.textTrackList.mediaElement)return-1;for(var e=i.track,t=e.textTrackList,s=0,r=0;ri.left&&this.topi.top};Ve.prototype.overlapsAny=function(i){for(var e=0;e=i.top&&this.bottom<=i.bottom&&this.left>=i.left&&this.right<=i.right};Ve.prototype.overlapsOppositeAxis=function(i,e){switch(e){case"+x":return this.lefti.right;case"+y":return this.topi.bottom}};Ve.prototype.intersectPercentage=function(i){var e=Math.max(0,Math.min(this.right,i.right)-Math.max(this.left,i.left)),t=Math.max(0,Math.min(this.bottom,i.bottom)-Math.max(this.top,i.top)),s=e*t;return s/(this.height*this.width)};Ve.prototype.toCSSCompatValues=function(i){return{top:this.top-i.top,bottom:i.bottom-this.bottom,left:this.left-i.left,right:i.right-this.right,height:this.height,width:this.width}};Ve.getSimpleBoxPosition=function(i){var e=i.div?i.div.offsetHeight:i.tagName?i.offsetHeight:0,t=i.div?i.div.offsetWidth:i.tagName?i.offsetWidth:0,s=i.div?i.div.offsetTop:i.tagName?i.offsetTop:0;i=i.div?i.div.getBoundingClientRect():i.tagName?i.getBoundingClientRect():i;var r={left:i.left,right:i.right,top:i.top||s,height:i.height||e,bottom:i.bottom||s+(i.height||e),width:i.width||t};return r};function x_(i,e,t,s){function r(A,D){for(var P,k=new Ve(A),O=1,R=0;Rq&&(P=new Ve(A),O=q),A=new Ve(k)}return P||k}var n=new Ve(e),a=e.cue,o=S_(a),u=[];if(a.snapToLines){var c;switch(a.vertical){case"":u=["+y","-y"],c="height";break;case"rl":u=["+x","-x"],c="width";break;case"lr":u=["-x","+x"],c="width";break}var p=n.lineHeight,y=p*Math.round(o),T=t[c]+p,x=u[0];Math.abs(y)>T&&(y=y<0?-1:1,y*=Math.ceil(T/p)*p),o<0&&(y+=a.vertical===""?t.height:t.width,u=u.reverse()),n.move(x,y)}else{var S=n.lineHeight/t.height*100;switch(a.lineAlign){case"center":o-=S/2;break;case"end":o-=S;break}switch(a.vertical){case"":e.applyStyles({top:e.formatStyle(o,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(o,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(o,"%")});break}u=["+y","-x","+x","-y"],n=new Ve(e)}var _=r(n,u);e.move(_.toCSSCompatValues(t))}function vs(){}vs.StringDecoder=function(){return{decode:function(i){if(!i)return"";if(typeof i!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(i))}}};vs.convertCueToDOMTree=function(i,e){return!i||!e?null:vh(i,e)};var E_=.05,C_="sans-serif",w_="1.5%";vs.processCues=function(i,e,t){if(!i||!e||!t)return null;for(;t.firstChild;)t.removeChild(t.firstChild);var s=i.document.createElement("div");s.style.position="absolute",s.style.left="0",s.style.right="0",s.style.top="0",s.style.bottom="0",s.style.margin=w_,t.appendChild(s);function r(p){for(var y=0;y")===-1){e.cue.id=a;continue}case"CUE":try{y_(a,e.cue,e.regionList)}catch(p){e.reportOrThrowError(p),e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":var c=a.indexOf("-->")!==-1;if(!a||c&&(u=!0)){e.oncue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}e.cue.text&&(e.cue.text+=` `),e.cue.text+=a.replace(/\u2028/g,` `).replace(/u2029/g,` `);continue;case"BADCUE":a||(e.state="ID");continue}}}catch(p){e.reportOrThrowError(p),e.state==="CUETEXT"&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var i=this;try{if(i.buffer+=i.decoder.decode(),(i.cue||i.state==="HEADER")&&(i.buffer+=` `,i.parse()),i.state==="INITIAL")throw new nt(nt.Errors.BadSignature)}catch(e){i.reportOrThrowError(e)}return i.onflush&&i.onflush(),this}};var A_=vs,D_="auto",k_={"":1,lr:1,rl:1},I_={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function P_(i){if(typeof i!="string")return!1;var e=k_[i.toLowerCase()];return e?i.toLowerCase():!1}function lo(i){if(typeof i!="string")return!1;var e=I_[i.toLowerCase()];return e?i.toLowerCase():!1}function Sh(i,e,t){this.hasBeenReset=!1;var s="",r=!1,n=i,a=e,o=t,u=null,c="",p=!0,y="auto",T="start",x="auto",S="auto",_=100,A="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return s},set:function(D){s=""+D}},pauseOnExit:{enumerable:!0,get:function(){return r},set:function(D){r=!!D}},startTime:{enumerable:!0,get:function(){return n},set:function(D){if(typeof D!="number")throw new TypeError("Start time must be set to a number.");n=D,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return a},set:function(D){if(typeof D!="number")throw new TypeError("End time must be set to a number.");a=D,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(D){o=""+D,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return u},set:function(D){u=D,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return c},set:function(D){var P=P_(D);if(P===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");c=P,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return p},set:function(D){p=!!D,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return y},set:function(D){if(typeof D!="number"&&D!==D_)throw new SyntaxError("Line: an invalid number or illegal string was specified.");y=D,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return T},set:function(D){var P=lo(D);P?(T=P,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return x},set:function(D){if(D<0||D>100)throw new Error("Position must be between 0 and 100.");x=D,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return S},set:function(D){var P=lo(D);P?(S=P,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return _},set:function(D){if(D<0||D>100)throw new Error("Size must be between 0 and 100.");_=D,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return A},set:function(D){var P=lo(D);if(!P)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");A=P,this.hasBeenReset=!0}}}),this.displayState=void 0}Sh.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var O_=Sh,L_={"":!0,up:!0};function R_(i){if(typeof i!="string")return!1;var e=L_[i.toLowerCase()];return e?i.toLowerCase():!1}function Gs(i){return typeof i=="number"&&i>=0&&i<=100}function N_(){var i=100,e=3,t=0,s=100,r=0,n=100,a="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return i},set:function(o){if(!Gs(o))throw new Error("Width must be between 0 and 100.");i=o}},lines:{enumerable:!0,get:function(){return e},set:function(o){if(typeof o!="number")throw new TypeError("Lines must be set to a number.");e=o}},regionAnchorY:{enumerable:!0,get:function(){return s},set:function(o){if(!Gs(o))throw new Error("RegionAnchorX must be between 0 and 100.");s=o}},regionAnchorX:{enumerable:!0,get:function(){return t},set:function(o){if(!Gs(o))throw new Error("RegionAnchorY must be between 0 and 100.");t=o}},viewportAnchorY:{enumerable:!0,get:function(){return n},set:function(o){if(!Gs(o))throw new Error("ViewportAnchorY must be between 0 and 100.");n=o}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(o){if(!Gs(o))throw new Error("ViewportAnchorX must be between 0 and 100.");r=o}},scroll:{enumerable:!0,get:function(){return a},set:function(o){var u=R_(o);u===!1?console.warn("Scroll: an invalid or illegal string was specified."):a=u}}})}var M_=N_,zt=ra,Fi=bh.exports={WebVTT:A_,VTTCue:O_,VTTRegion:M_};zt.vttjs=Fi;zt.WebVTT=Fi.WebVTT;var B_=Fi.VTTCue,F_=Fi.VTTRegion,U_=zt.VTTCue,q_=zt.VTTRegion;Fi.shim=function(){zt.VTTCue=B_,zt.VTTRegion=F_};Fi.restore=function(){zt.VTTCue=U_,zt.VTTRegion=q_};zt.VTTCue||Fi.shim();var $_=bh.exports;const Dc=xr($_);var kc="https://example.com",aa=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=C.location&&C.location.href||"");var s=/^\/\//.test(e),r=!C.location&&!/\/\//i.test(e);e=new C.URL(e,C.location||kc);var n=new URL(t,e);return r?n.href.slice(kc.length):s?n.href.slice(n.protocol.length):n.href},Cl=function(){function i(){this.listeners={}}var e=i.prototype;return e.on=function(s,r){this.listeners[s]||(this.listeners[s]=[]),this.listeners[s].push(r)},e.off=function(s,r){if(!this.listeners[s])return!1;var n=this.listeners[s].indexOf(r);return this.listeners[s]=this.listeners[s].slice(0),this.listeners[s].splice(n,1),n>-1},e.trigger=function(s){var r=this.listeners[s];if(r)if(arguments.length===2)for(var n=r.length,a=0;a-1;t=this.buffer.indexOf(` `))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const V_=" ",uo=function(i){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(i||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t},z_=function(){const t="(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")";return new RegExp("(?:^|,)("+t+")")},$e=function(i){const e={};if(!i)return e;const t=i.split(z_());let s=t.length,r;for(;s--;)t[s]!==""&&(r=/([^=]*)=(.*)/.exec(t[s]).slice(1),r[0]=r[0].replace(/^\s+|\s+$/g,""),r[1]=r[1].replace(/^\s+|\s+$/g,""),r[1]=r[1].replace(/^['"](.*)['"]$/g,"$1"),e[r[0]]=r[1]);return e},Ic=i=>{const e=i.split("x"),t={};return e[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),t};class W_ extends Cl{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,s;if(e=e.trim(),e.length===0)return;if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((n,a)=>{const o=a(e);return o===e?n:n.concat([o])},[e]).forEach(n=>{for(let a=0;an),this.customParsers.push(n=>{if(e.exec(n))return this.trigger("data",{type:"custom",data:s(n),customType:t,segment:r}),!0})}addTagMapper({expression:e,map:t}){const s=r=>e.test(r)?t(r):r;this.tagMappers.push(s)}}const G_=i=>i.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),ei=function(i){const e={};return Object.keys(i).forEach(function(t){e[G_(t)]=i[t]}),e},co=function(i){const{serverControl:e,targetDuration:t,partTargetDuration:s}=i;if(!e)return;const r="#EXT-X-SERVER-CONTROL",n="holdBack",a="partHoldBack",o=t&&t*3,u=s&&s*2;t&&!e.hasOwnProperty(n)&&(e[n]=o,this.trigger("info",{message:`${r} defaulting HOLD-BACK to targetDuration * 3 (${o}).`})),o&&e[n]{r.uri||!r.parts&&!r.preloadHints||(!r.map&&n&&(r.map=n),!r.key&&a&&(r.key=a),!r.timeline&&typeof y=="number"&&(r.timeline=y),this.manifest.preloadSegment=r)}),this.parseStream.on("data",function(_){let A,D;if(t.manifest.definitions){for(const P in t.manifest.definitions)if(_.uri&&(_.uri=_.uri.replace(`{$${P}}`,t.manifest.definitions[P])),_.attributes)for(const k in _.attributes)typeof _.attributes[k]=="string"&&(_.attributes[k]=_.attributes[k].replace(`{$${P}}`,t.manifest.definitions[P]))}({tag(){({version(){_.version&&(this.manifest.version=_.version)},"allow-cache"(){this.manifest.allowCache=_.allowed,"allowed"in _||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const P={};"length"in _&&(r.byterange=P,P.length=_.length,"offset"in _||(_.offset=T)),"offset"in _&&(r.byterange=P,P.offset=_.offset),T=P.offset+P.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),_.title&&(r.title=_.title),_.duration>0&&(r.duration=_.duration),_.duration===0&&(r.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=s},key(){if(!_.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(_.attributes.METHOD==="NONE"){a=null;return}if(!_.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(_.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:_.attributes};return}if(_.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:_.attributes.URI};return}if(_.attributes.KEYFORMAT===p){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(_.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(_.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),_.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(_.attributes.KEYID&&_.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:_.attributes.KEYFORMAT,keyId:_.attributes.KEYID.substring(2)},pssh:xh(_.attributes.URI.split(",")[1])};return}_.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),a={method:_.attributes.METHOD||"AES-128",uri:_.attributes.URI},typeof _.attributes.IV<"u"&&(a.iv=_.attributes.IV)},"media-sequence"(){if(!isFinite(_.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+_.number});return}this.manifest.mediaSequence=_.number},"discontinuity-sequence"(){if(!isFinite(_.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+_.number});return}this.manifest.discontinuitySequence=_.number,y=_.number},"playlist-type"(){if(!/VOD|EVENT/.test(_.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+_.playlist});return}this.manifest.playlistType=_.playlistType},map(){n={},_.uri&&(n.uri=_.uri),_.byterange&&(n.byterange=_.byterange),a&&(n.key=a)},"stream-inf"(){if(this.manifest.playlists=s,this.manifest.mediaGroups=this.manifest.mediaGroups||c,!_.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}r.attributes||(r.attributes={}),ve(r.attributes,_.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||c,!(_.attributes&&_.attributes.TYPE&&_.attributes["GROUP-ID"]&&_.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const P=this.manifest.mediaGroups[_.attributes.TYPE];P[_.attributes["GROUP-ID"]]=P[_.attributes["GROUP-ID"]]||{},A=P[_.attributes["GROUP-ID"]],D={default:/yes/i.test(_.attributes.DEFAULT)},D.default?D.autoselect=!0:D.autoselect=/yes/i.test(_.attributes.AUTOSELECT),_.attributes.LANGUAGE&&(D.language=_.attributes.LANGUAGE),_.attributes.URI&&(D.uri=_.attributes.URI),_.attributes["INSTREAM-ID"]&&(D.instreamId=_.attributes["INSTREAM-ID"]),_.attributes.CHARACTERISTICS&&(D.characteristics=_.attributes.CHARACTERISTICS),_.attributes.FORCED&&(D.forced=/yes/i.test(_.attributes.FORCED)),A[_.attributes.NAME]=D},discontinuity(){y+=1,r.discontinuity=!0,this.manifest.discontinuityStarts.push(s.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=_.dateTimeString,this.manifest.dateTimeObject=_.dateTimeObject),r.dateTimeString=_.dateTimeString,r.dateTimeObject=_.dateTimeObject;const{lastProgramDateTime:P}=this;this.lastProgramDateTime=new Date(_.dateTimeString).getTime(),P===null&&this.manifest.segments.reduceRight((k,O)=>(O.programDateTime=k-O.duration*1e3,O.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(_.duration)||_.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+_.duration});return}this.manifest.targetDuration=_.duration,co.call(this,this.manifest)},start(){if(!_.attributes||isNaN(_.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:_.attributes["TIME-OFFSET"],precise:_.attributes.PRECISE}},"cue-out"(){r.cueOut=_.data},"cue-out-cont"(){r.cueOutCont=_.data},"cue-in"(){r.cueIn=_.data},skip(){this.manifest.skip=ei(_.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",_.attributes,["SKIPPED-SEGMENTS"])},part(){o=!0;const P=this.manifest.segments.length,k=ei(_.attributes);r.parts=r.parts||[],r.parts.push(k),k.byterange&&(k.byterange.hasOwnProperty("offset")||(k.byterange.offset=x),x=k.byterange.offset+k.byterange.length);const O=r.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${O} for segment #${P}`,_.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((R,q)=>{R.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${q} lacks required attribute(s): LAST-PART`})})},"server-control"(){const P=this.manifest.serverControl=ei(_.attributes);P.hasOwnProperty("canBlockReload")||(P.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),co.call(this,this.manifest),P.canSkipDateranges&&!P.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const P=this.manifest.segments.length,k=ei(_.attributes),O=k.type&&k.type==="PART";r.preloadHints=r.preloadHints||[],r.preloadHints.push(k),k.byterange&&(k.byterange.hasOwnProperty("offset")||(k.byterange.offset=O?x:0,O&&(x=k.byterange.offset+k.byterange.length)));const R=r.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${R} for segment #${P}`,_.attributes,["TYPE","URI"]),!!k.type)for(let q=0;qq.id===k.id);this.manifest.dateRanges[R]=ve(this.manifest.dateRanges[R],k),S[k.id]=ve(S[k.id],k),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=ei(_.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",_.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const P=(k,O)=>{if(k in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${k}`});return}this.manifest.definitions[k]=O};if("QUERYPARAM"in _.attributes){if("NAME"in _.attributes||"IMPORT"in _.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const k=this.params.get(_.attributes.QUERYPARAM);if(!k){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${_.attributes.QUERYPARAM}`});return}P(_.attributes.QUERYPARAM,decodeURIComponent(k));return}if("NAME"in _.attributes){if("IMPORT"in _.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in _.attributes)||typeof _.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${_.attributes.NAME}`});return}P(_.attributes.NAME,_.attributes.VALUE);return}if("IMPORT"in _.attributes){if(!this.mainDefinitions[_.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${_.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}P(_.attributes.IMPORT,this.mainDefinitions[_.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:_.attributes,uri:_.uri,timeline:y}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",_.attributes,["BANDWIDTH","URI"])}}[_.tagType]||u).call(t)},uri(){r.uri=_.uri,s.push(r),this.manifest.targetDuration&&!("duration"in r)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),r.duration=this.manifest.targetDuration),a&&(r.key=a),r.timeline=y,n&&(r.map=n),x=0,this.lastProgramDateTime!==null&&(r.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=r.duration*1e3),r={}},comment(){},custom(){_.segment?(r.custom=r.custom||{},r.custom[_.customType]=_.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[_.customType]=_.data)}})[_.type].call(t)})}requiredCompatibilityversion(e,t){(ey&&(p-=y,p-=y,p-=Le(2))}return Number(p)},nT=function(e,t){var s={},r=s.le,n=r===void 0?!1:r;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=Le(e);for(var a=iT(e),o=new Uint8Array(new ArrayBuffer(a)),u=0;u=t.length&&c.call(t,function(p,y){var T=u[y]?u[y]&e[a+y]:e[a+y];return p===T})},oT=function(e,t,s){t.forEach(function(r){for(var n in e.mediaGroups[r])for(var a in e.mediaGroups[r][n]){var o=e.mediaGroups[r][n][a];s(o,r,n,a)}})},hi={},Kt={};function lT(i,e,t){if(t===void 0&&(t=Array.prototype),i&&typeof t.find=="function")return t.find.call(i,e);for(var s=0;s=0&&i=0){for(var r=e.length-1;s0},lookupPrefix:function(i){for(var e=this;e;){var t=e._nsMap;if(t){for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&t[s]===i)return s}e=e.nodeType==cs?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(i){for(var e=this;e;){var t=e._nsMap;if(t&&Object.prototype.hasOwnProperty.call(t,i))return t[i];e=e.nodeType==cs?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(i){var e=this.lookupPrefix(i);return e==null}};function $h(i){return i=="<"&&"<"||i==">"&&">"||i=="&"&&"&"||i=='"'&&"""||"&#"+i.charCodeAt()+";"}Er(tt,oe);Er(tt,oe.prototype);function mr(i,e){if(e(i))return!0;if(i=i.firstChild)do if(mr(i,e))return!0;while(i=i.nextSibling)}function Cr(){this.ownerDocument=this}function gT(i,e,t){i&&i._inc++;var s=t.namespaceURI;s===pr.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function jh(i,e,t,s){i&&i._inc++;var r=t.namespaceURI;r===pr.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function Dl(i,e,t){if(i&&i._inc){i._inc++;var s=e.childNodes;if(t)s[s.length++]=t;else{for(var r=e.firstChild,n=0;r;)s[n++]=r,r=r.nextSibling;s.length=n,delete s[s.length]}}}function Hh(i,e){var t=e.previousSibling,s=e.nextSibling;return t?t.nextSibling=s:i.firstChild=s,s?s.previousSibling=t:i.lastChild=t,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,Dl(i.ownerDocument,i),e}function yT(i){return i&&(i.nodeType===oe.DOCUMENT_NODE||i.nodeType===oe.DOCUMENT_FRAGMENT_NODE||i.nodeType===oe.ELEMENT_NODE)}function _T(i){return i&&(Ot(i)||kl(i)||Gt(i)||i.nodeType===oe.DOCUMENT_FRAGMENT_NODE||i.nodeType===oe.COMMENT_NODE||i.nodeType===oe.PROCESSING_INSTRUCTION_NODE)}function Gt(i){return i&&i.nodeType===oe.DOCUMENT_TYPE_NODE}function Ot(i){return i&&i.nodeType===oe.ELEMENT_NODE}function kl(i){return i&&i.nodeType===oe.TEXT_NODE}function Bc(i,e){var t=i.childNodes||[];if(Pt(t,Ot)||Gt(e))return!1;var s=Pt(t,Gt);return!(e&&s&&t.indexOf(s)>t.indexOf(e))}function Fc(i,e){var t=i.childNodes||[];function s(n){return Ot(n)&&n!==e}if(Pt(t,s))return!1;var r=Pt(t,Gt);return!(e&&r&&t.indexOf(r)>t.indexOf(e))}function TT(i,e,t){if(!yT(i))throw new Ce(Xe,"Unexpected parent node type "+i.nodeType);if(t&&t.parentNode!==i)throw new Ce(Fh,"child not in parent");if(!_T(e)||Gt(e)&&i.nodeType!==oe.DOCUMENT_NODE)throw new Ce(Xe,"Unexpected node type "+e.nodeType+" for parent node type "+i.nodeType)}function bT(i,e,t){var s=i.childNodes||[],r=e.childNodes||[];if(e.nodeType===oe.DOCUMENT_FRAGMENT_NODE){var n=r.filter(Ot);if(n.length>1||Pt(r,kl))throw new Ce(Xe,"More than one element or text in fragment");if(n.length===1&&!Bc(i,t))throw new Ce(Xe,"Element in fragment can not be inserted before doctype")}if(Ot(e)&&!Bc(i,t))throw new Ce(Xe,"Only one element can be added and only after doctype");if(Gt(e)){if(Pt(s,Gt))throw new Ce(Xe,"Only one doctype is allowed");var a=Pt(s,Ot);if(t&&s.indexOf(a)1||Pt(r,kl))throw new Ce(Xe,"More than one element or text in fragment");if(n.length===1&&!Fc(i,t))throw new Ce(Xe,"Element in fragment can not be inserted before doctype")}if(Ot(e)&&!Fc(i,t))throw new Ce(Xe,"Only one element can be added and only after doctype");if(Gt(e)){let u=function(c){return Gt(c)&&c!==t};var o=u;if(Pt(s,u))throw new Ce(Xe,"Only one doctype is allowed");var a=Pt(s,Ot);if(t&&s.indexOf(a)0&&mr(t.documentElement,function(r){if(r!==t&&r.nodeType===gt){var n=r.getAttribute("class");if(n){var a=i===n;if(!a){var o=Lc(n);a=e.every(fT(o))}a&&s.push(r)}}}),s})},createElement:function(i){var e=new Ri;e.ownerDocument=this,e.nodeName=i,e.tagName=i,e.localName=i,e.childNodes=new Ht;var t=e.attributes=new On;return t._ownerElement=e,e},createDocumentFragment:function(){var i=new la;return i.ownerDocument=this,i.childNodes=new Ht,i},createTextNode:function(i){var e=new Il;return e.ownerDocument=this,e.appendData(i),e},createComment:function(i){var e=new Pl;return e.ownerDocument=this,e.appendData(i),e},createCDATASection:function(i){var e=new Ol;return e.ownerDocument=this,e.appendData(i),e},createProcessingInstruction:function(i,e){var t=new Rl;return t.ownerDocument=this,t.tagName=t.nodeName=t.target=i,t.nodeValue=t.data=e,t},createAttribute:function(i){var e=new Rn;return e.ownerDocument=this,e.name=i,e.nodeName=i,e.localName=i,e.specified=!0,e},createEntityReference:function(i){var e=new Ll;return e.ownerDocument=this,e.nodeName=i,e},createElementNS:function(i,e){var t=new Ri,s=e.split(":"),r=t.attributes=new On;return t.childNodes=new Ht,t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.namespaceURI=i,s.length==2?(t.prefix=s[0],t.localName=s[1]):t.localName=e,r._ownerElement=t,t},createAttributeNS:function(i,e){var t=new Rn,s=e.split(":");return t.ownerDocument=this,t.nodeName=e,t.name=e,t.namespaceURI=i,t.specified=!0,s.length==2?(t.prefix=s[0],t.localName=s[1]):t.localName=e,t}};et(Cr,oe);function Ri(){this._nsMap={}}Ri.prototype={nodeType:gt,hasAttribute:function(i){return this.getAttributeNode(i)!=null},getAttribute:function(i){var e=this.getAttributeNode(i);return e&&e.value||""},getAttributeNode:function(i){return this.attributes.getNamedItem(i)},setAttribute:function(i,e){var t=this.ownerDocument.createAttribute(i);t.value=t.nodeValue=""+e,this.setAttributeNode(t)},removeAttribute:function(i){var e=this.getAttributeNode(i);e&&this.removeAttributeNode(e)},appendChild:function(i){return i.nodeType===Wt?this.insertBefore(i,null):vT(this,i)},setAttributeNode:function(i){return this.attributes.setNamedItem(i)},setAttributeNodeNS:function(i){return this.attributes.setNamedItemNS(i)},removeAttributeNode:function(i){return this.attributes.removeNamedItem(i.nodeName)},removeAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);t&&this.removeAttributeNode(t)},hasAttributeNS:function(i,e){return this.getAttributeNodeNS(i,e)!=null},getAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);return t&&t.value||""},setAttributeNS:function(i,e,t){var s=this.ownerDocument.createAttributeNS(i,e);s.value=s.nodeValue=""+t,this.setAttributeNode(s)},getAttributeNodeNS:function(i,e){return this.attributes.getNamedItemNS(i,e)},getElementsByTagName:function(i){return new ds(this,function(e){var t=[];return mr(e,function(s){s!==e&&s.nodeType==gt&&(i==="*"||s.tagName==i)&&t.push(s)}),t})},getElementsByTagNameNS:function(i,e){return new ds(this,function(t){var s=[];return mr(t,function(r){r!==t&&r.nodeType===gt&&(i==="*"||r.namespaceURI===i)&&(e==="*"||r.localName==e)&&s.push(r)}),s})}};Cr.prototype.getElementsByTagName=Ri.prototype.getElementsByTagName;Cr.prototype.getElementsByTagNameNS=Ri.prototype.getElementsByTagNameNS;et(Ri,oe);function Rn(){}Rn.prototype.nodeType=cs;et(Rn,oe);function wr(){}wr.prototype={data:"",substringData:function(i,e){return this.data.substring(i,i+e)},appendData:function(i){i=this.data+i,this.nodeValue=this.data=i,this.length=i.length},insertData:function(i,e){this.replaceData(i,0,e)},appendChild:function(i){throw new Error(Oe[Xe])},deleteData:function(i,e){this.replaceData(i,e,"")},replaceData:function(i,e,t){var s=this.data.substring(0,i),r=this.data.substring(i+e);t=s+t+r,this.nodeValue=this.data=t,this.length=t.length}};et(wr,oe);function Il(){}Il.prototype={nodeName:"#text",nodeType:Pn,splitText:function(i){var e=this.data,t=e.substring(i);e=e.substring(0,i),this.data=this.nodeValue=e,this.length=e.length;var s=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(s,this.nextSibling),s}};et(Il,wr);function Pl(){}Pl.prototype={nodeName:"#comment",nodeType:Nh};et(Pl,wr);function Ol(){}Ol.prototype={nodeName:"#cdata-section",nodeType:Oh};et(Ol,wr);function oa(){}oa.prototype.nodeType=Bh;et(oa,oe);function zh(){}zh.prototype.nodeType=mT;et(zh,oe);function Wh(){}Wh.prototype.nodeType=pT;et(Wh,oe);function Ll(){}Ll.prototype.nodeType=Lh;et(Ll,oe);function la(){}la.prototype.nodeName="#document-fragment";la.prototype.nodeType=Wt;et(la,oe);function Rl(){}Rl.prototype.nodeType=Rh;et(Rl,oe);function Gh(){}Gh.prototype.serializeToString=function(i,e,t){return Xh.call(i,e,t)};oe.prototype.toString=Xh;function Xh(i,e){var t=[],s=this.nodeType==9&&this.documentElement||this,r=s.prefix,n=s.namespaceURI;if(n&&r==null){var r=s.lookupPrefix(n);if(r==null)var a=[{namespace:n,prefix:null}]}return Ki(this,t,i,e,a),t.join("")}function Uc(i,e,t){var s=i.prefix||"",r=i.namespaceURI;if(!r||s==="xml"&&r===pr.XML||r===pr.XMLNS)return!1;for(var n=t.length;n--;){var a=t[n];if(a.prefix===s)return a.namespace!==r}return!0}function fo(i,e,t){i.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,$h),'"')}function Ki(i,e,t,s,r){if(r||(r=[]),s)if(i=s(i),i){if(typeof i=="string"){e.push(i);return}}else return;switch(i.nodeType){case gt:var n=i.attributes,a=n.length,D=i.firstChild,o=i.tagName;t=pr.isHTML(i.namespaceURI)||t;var u=o;if(!t&&!i.prefix&&i.namespaceURI){for(var c,p=0;p=0;y--){var T=r[y];if(T.prefix===""&&T.namespace===i.namespaceURI){c=T.namespace;break}}if(c!==i.namespaceURI)for(var y=r.length-1;y>=0;y--){var T=r[y];if(T.namespace===i.namespaceURI){T.prefix&&(u=T.prefix+":"+o);break}}}e.push("<",u);for(var x=0;x"),t&&/^script$/i.test(o))for(;D;)D.data?e.push(D.data):Ki(D,e,t,s,r.slice()),D=D.nextSibling;else for(;D;)Ki(D,e,t,s,r.slice()),D=D.nextSibling;e.push("")}else e.push("/>");return;case Mh:case Wt:for(var D=i.firstChild;D;)Ki(D,e,t,s,r.slice()),D=D.nextSibling;return;case cs:return fo(e,i.name,i.value);case Pn:return e.push(i.data.replace(/[<&>]/g,$h));case Oh:return e.push("");case Nh:return e.push("");case Bh:var P=i.publicId,k=i.systemId;if(e.push("");else if(k&&k!=".")e.push(" SYSTEM ",k,">");else{var O=i.internalSubset;O&&e.push(" [",O,"]"),e.push(">")}return;case Rh:return e.push("");case Lh:return e.push("&",i.nodeName,";");default:e.push("??",i.nodeName)}}function Kh(i,e,t){var s;switch(e.nodeType){case gt:s=e.cloneNode(!1),s.ownerDocument=i;case Wt:break;case cs:t=!0;break}if(s||(s=e.cloneNode(!1)),s.ownerDocument=i,s.parentNode=null,t)for(var r=e.firstChild;r;)s.appendChild(Kh(i,r,t)),r=r.nextSibling;return s}function No(i,e,t){var s=new e.constructor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=e[r];typeof n!="object"&&n!=s[r]&&(s[r]=n)}switch(e.childNodes&&(s.childNodes=new Ht),s.ownerDocument=i,s.nodeType){case gt:var a=e.attributes,o=s.attributes=new On,u=a.length;o._ownerElement=s;for(var c=0;c",lt:"<",quot:'"'}),i.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:` `,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),i.entityMap=i.HTML_ENTITIES})(Qh);var Nl={},gr=Kt.NAMESPACE,Mo=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,qc=new RegExp("[\\-\\.0-9"+Mo.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),$c=new RegExp("^"+Mo.source+qc.source+"*(?::"+Mo.source+qc.source+"*)?$"),Xs=0,ti=1,ji=2,Ks=3,Hi=4,Vi=5,Ys=6,fn=7;function hs(i,e){this.message=i,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,hs)}hs.prototype=new Error;hs.prototype.name=hs.name;function Jh(){}Jh.prototype={parse:function(i,e,t){var s=this.domBuilder;s.startDocument(),Zh(e,e={}),ST(i,e,t,s,this.errorHandler),s.endDocument()}};function ST(i,e,t,s,r){function n(ie){if(ie>65535){ie-=65536;var Se=55296+(ie>>10),Bt=56320+(ie&1023);return String.fromCharCode(Se,Bt)}else return String.fromCharCode(ie)}function a(ie){var Se=ie.slice(1,-1);return Object.hasOwnProperty.call(t,Se)?t[Se]:Se.charAt(0)==="#"?n(parseInt(Se.substr(1).replace("x","0x"))):(r.error("entity not found:"+ie),ie)}function o(ie){if(ie>_){var Se=i.substring(_,ie).replace(/&#?\w+;/g,a);T&&u(_),s.characters(Se,0,ie-_),_=ie}}function u(ie,Se){for(;ie>=p&&(Se=y.exec(i));)c=Se.index,p=c+Se[0].length,T.lineNumber++;T.columnNumber=ie-c+1}for(var c=0,p=0,y=/.*(?:\r\n?|\n)|.*$/g,T=s.locator,x=[{currentNSMap:e}],S={},_=0;;){try{var A=i.indexOf("<",_);if(A<0){if(!i.substr(_).match(/^\s*$/)){var D=s.doc,P=D.createTextNode(i.substr(_));D.appendChild(P),s.currentElement=P}return}switch(A>_&&o(A),i.charAt(A+1)){case"/":var ee=i.indexOf(">",A+3),k=i.substring(A+2,ee).replace(/[ \t\n\r]+$/g,""),O=x.pop();ee<0?(k=i.substring(A+2).replace(/[\s<].*/,""),r.error("end tag name: "+k+" is not complete:"+O.tagName),ee=A+1+k.length):k.match(/\s_?_=ee:o(Math.max(A,_)+1)}}function jc(i,e){return e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber,e}function xT(i,e,t,s,r,n){function a(T,x,S){t.attributeNames.hasOwnProperty(T)&&n.fatalError("Attribute "+T+" redefined"),t.addValue(T,x.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,r),S)}for(var o,u,c=++e,p=Xs;;){var y=i.charAt(c);switch(y){case"=":if(p===ti)o=i.slice(e,c),p=Ks;else if(p===ji)p=Ks;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(p===Ks||p===ti)if(p===ti&&(n.warning('attribute value must after "="'),o=i.slice(e,c)),e=c+1,c=i.indexOf(y,e),c>0)u=i.slice(e,c),a(o,u,e-1),p=Vi;else throw new Error("attribute value no end '"+y+"' match");else if(p==Hi)u=i.slice(e,c),a(o,u,e),n.warning('attribute "'+o+'" missed start quot('+y+")!!"),e=c+1,p=Vi;else throw new Error('attribute value must after "="');break;case"/":switch(p){case Xs:t.setTagName(i.slice(e,c));case Vi:case Ys:case fn:p=fn,t.closed=!0;case Hi:case ti:break;case ji:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return n.error("unexpected end of input"),p==Xs&&t.setTagName(i.slice(e,c)),c;case">":switch(p){case Xs:t.setTagName(i.slice(e,c));case Vi:case Ys:case fn:break;case Hi:case ti:u=i.slice(e,c),u.slice(-1)==="/"&&(t.closed=!0,u=u.slice(0,-1));case ji:p===ji&&(u=o),p==Hi?(n.warning('attribute "'+u+'" missed quot(")!'),a(o,u,e)):((!gr.isHTML(s[""])||!u.match(/^(?:disabled|checked|selected)$/i))&&n.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),a(u,u,e));break;case Ks:throw new Error("attribute value missed!!")}return c;case"€":y=" ";default:if(y<=" ")switch(p){case Xs:t.setTagName(i.slice(e,c)),p=Ys;break;case ti:o=i.slice(e,c),p=ji;break;case Hi:var u=i.slice(e,c);n.warning('attribute "'+u+'" missed quot(")!!'),a(o,u,e);case Vi:p=Ys;break}else switch(p){case ji:t.tagName,(!gr.isHTML(s[""])||!o.match(/^(?:disabled|checked|selected)$/i))&&n.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,e),e=c,p=ti;break;case Vi:n.warning('attribute space is required"'+o+'"!!');case Ys:p=ti,e=c;break;case Ks:p=Hi,e=c;break;case fn:throw new Error("elements closed character '/' and '>' must be connected to")}}c++}}function Hc(i,e,t){for(var s=i.tagName,r=null,y=i.length;y--;){var n=i[y],a=n.qName,o=n.value,T=a.indexOf(":");if(T>0)var u=n.prefix=a.slice(0,T),c=a.slice(T+1),p=u==="xmlns"&&c;else c=a,u=null,p=a==="xmlns"&&"";n.localName=c,p!==!1&&(r==null&&(r={},Zh(t,t={})),t[p]=r[p]=o,n.uri=gr.XMLNS,e.startPrefixMapping(p,o))}for(var y=i.length;y--;){n=i[y];var u=n.prefix;u&&(u==="xml"&&(n.uri=gr.XML),u!=="xmlns"&&(n.uri=t[u||""]))}var T=s.indexOf(":");T>0?(u=i.prefix=s.slice(0,T),c=i.localName=s.slice(T+1)):(u=null,c=i.localName=s);var x=i.uri=t[u||""];if(e.startElement(x,c,s,i),i.closed){if(e.endElement(x,c,s),r)for(u in r)Object.prototype.hasOwnProperty.call(r,u)&&e.endPrefixMapping(u)}else return i.currentNSMap=t,i.localNSMap=r,!0}function ET(i,e,t,s,r){if(/^(?:script|textarea)$/i.test(t)){var n=i.indexOf("",e),a=i.substring(e+1,n);if(/[&<]/.test(a))return/^script$/i.test(t)?(r.characters(a,0,a.length),n):(a=a.replace(/&#?\w+;/g,s),r.characters(a,0,a.length),n)}return e+1}function CT(i,e,t,s){var r=s[t];return r==null&&(r=i.lastIndexOf(""),r",e+4);return n>e?(t.comment(i,e+4,n-e-4),n+3):(s.error("Unclosed comment"),-1)}else return-1;default:if(i.substr(e+3,6)=="CDATA["){var n=i.indexOf("]]>",e+9);return t.startCDATA(),t.characters(i,e+9,n-e-9),t.endCDATA(),n+3}var a=DT(i,e),o=a.length;if(o>1&&/!doctype/i.test(a[0][0])){var u=a[1][0],c=!1,p=!1;o>3&&(/^public$/i.test(a[2][0])?(c=a[3][0],p=o>4&&a[4][0]):/^system$/i.test(a[2][0])&&(p=a[3][0]));var y=a[o-1];return t.startDTD(u,c,p),t.endDTD(),y.index+y[0].length}}return-1}function AT(i,e,t){var s=i.indexOf("?>",e);if(s){var r=i.substring(e,s).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return r?(r[0].length,t.processingInstruction(r[1],r[2]),s+2):-1}return-1}function ef(){this.attributeNames={}}ef.prototype={setTagName:function(i){if(!$c.test(i))throw new Error("invalid tagName:"+i);this.tagName=i},addValue:function(i,e,t){if(!$c.test(i))throw new Error("invalid attribute:"+i);this.attributeNames[i]=this.length,this[this.length++]={qName:i,value:e,offset:t}},length:0,getLocalName:function(i){return this[i].localName},getLocator:function(i){return this[i].locator},getQName:function(i){return this[i].qName},getURI:function(i){return this[i].uri},getValue:function(i){return this[i].value}};function DT(i,e){var t,s=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(r.lastIndex=e,r.exec(i);t=r.exec(i);)if(s.push(t),t[1])return s}Nl.XMLReader=Jh;Nl.ParseError=hs;var kT=Kt,IT=hi,Vc=Qh,tf=Nl,PT=IT.DOMImplementation,zc=kT.NAMESPACE,OT=tf.ParseError,LT=tf.XMLReader;function sf(i){return i.replace(/\r[\n\u0085]/g,` `).replace(/[\r\u0085\u2028]/g,` `)}function rf(i){this.options=i||{locator:{}}}rf.prototype.parseFromString=function(i,e){var t=this.options,s=new LT,r=t.domBuilder||new Ar,n=t.errorHandler,a=t.locator,o=t.xmlns||{},u=/\/x?html?$/.test(e),c=u?Vc.HTML_ENTITIES:Vc.XML_ENTITIES;a&&r.setDocumentLocator(a),s.errorHandler=RT(n,r,a),s.domBuilder=t.domBuilder||r,u&&(o[""]=zc.HTML),o.xml=o.xml||zc.XML;var p=t.normalizeLineEndings||sf;return i&&typeof i=="string"?s.parse(p(i),o,c):s.errorHandler.error("invalid doc source"),r.doc};function RT(i,e,t){if(!i){if(e instanceof Ar)return e;i=e}var s={},r=i instanceof Function;t=t||{};function n(a){var o=i[a];!o&&r&&(o=i.length==2?function(u){i(a,u)}:i),s[a]=o&&function(u){o("[xmldom "+a+"] "+u+Bo(t))}||function(){}}return n("warning"),n("error"),n("fatalError"),s}function Ar(){this.cdata=!1}function zi(i,e){e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber}Ar.prototype={startDocument:function(){this.doc=new PT().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(i,e,t,s){var r=this.doc,n=r.createElementNS(i,t||e),a=s.length;pn(this,n),this.currentElement=n,this.locator&&zi(this.locator,n);for(var o=0;o=e+t||e?new java.lang.String(i,e,t)+"":i}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(i){Ar.prototype[i]=function(){return null}});function pn(i,e){i.currentElement?i.currentElement.appendChild(e):i.doc.appendChild(e)}ua.__DOMHandler=Ar;ua.normalizeLineEndings=sf;ua.DOMParser=rf;var NT=ua.DOMParser;/*! @name mpd-parser @version 1.3.1 @license Apache-2.0 */const Gc=i=>!!i&&typeof i=="object",Ie=(...i)=>i.reduce((e,t)=>(typeof t!="object"||Object.keys(t).forEach(s=>{Array.isArray(e[s])&&Array.isArray(t[s])?e[s]=e[s].concat(t[s]):Gc(e[s])&&Gc(t[s])?e[s]=Ie(e[s],t[s]):e[s]=t[s]}),e),{}),nf=i=>Object.keys(i).map(e=>i[e]),MT=(i,e)=>{const t=[];for(let s=i;si.reduce((e,t)=>e.concat(t),[]),af=i=>{if(!i.length)return[];const e=[];for(let t=0;ti.reduce((t,s,r)=>(s[e]&&t.push(r),t),[]),FT=(i,e)=>nf(i.reduce((t,s)=>(s.forEach(r=>{t[e(r)]=r}),t),{}));var ps={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const yr=({baseUrl:i="",source:e="",range:t="",indexRange:s=""})=>{const r={uri:e,resolvedUri:aa(i||"",e)};if(t||s){const a=(t||s).split("-");let o=C.BigInt?C.BigInt(a[0]):parseInt(a[0],10),u=C.BigInt?C.BigInt(a[1]):parseInt(a[1],10);o{let e;return typeof i.offset=="bigint"||typeof i.length=="bigint"?e=C.BigInt(i.offset)+C.BigInt(i.length)-C.BigInt(1):e=i.offset+i.length-1,`${i.offset}-${e}`},Xc=i=>(i&&typeof i!="number"&&(i=parseInt(i,10)),isNaN(i)?null:i),qT={static(i){const{duration:e,timescale:t=1,sourceDuration:s,periodDuration:r}=i,n=Xc(i.endNumber),a=e/t;return typeof n=="number"?{start:0,end:n}:typeof r=="number"?{start:0,end:r/a}:{start:0,end:s/a}},dynamic(i){const{NOW:e,clientOffset:t,availabilityStartTime:s,timescale:r=1,duration:n,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:u=1/0}=i,c=Xc(i.endNumber),p=(e+t)/1e3,y=s+a,x=p+o-y,S=Math.ceil(x*r/n),_=Math.floor((p-y-u)*r/n),A=Math.floor((p-y)*r/n);return{start:Math.max(0,_),end:typeof c=="number"?c:Math.min(S,A)}}},$T=i=>e=>{const{duration:t,timescale:s=1,periodStart:r,startNumber:n=1}=i;return{number:n+e,duration:t/s,timeline:r,time:e*t}},Ml=i=>{const{type:e,duration:t,timescale:s=1,periodDuration:r,sourceDuration:n}=i,{start:a,end:o}=qT[e](i),u=MT(a,o).map($T(i));if(e==="static"){const c=u.length-1,p=typeof r=="number"?r:n;u[c].duration=p-t/s*c}return u},of=i=>{const{baseUrl:e,initialization:t={},sourceDuration:s,indexRange:r="",periodStart:n,presentationTime:a,number:o=0,duration:u}=i;if(!e)throw new Error(ps.NO_BASE_URL);const c=yr({baseUrl:e,source:t.sourceURL,range:t.range}),p=yr({baseUrl:e,source:e,indexRange:r});if(p.map=c,u){const y=Ml(i);y.length&&(p.duration=y[0].duration,p.timeline=y[0].timeline)}else s&&(p.duration=s,p.timeline=n);return p.presentationTime=a||n,p.number=o,[p]},Bl=(i,e,t)=>{const s=i.sidx.map?i.sidx.map:null,r=i.sidx.duration,n=i.timeline||0,a=i.sidx.byterange,o=a.offset+a.length,u=e.timescale,c=e.references.filter(A=>A.referenceType!==1),p=[],y=i.endList?"static":"dynamic",T=i.sidx.timeline;let x=T,S=i.mediaSequence||0,_;typeof e.firstOffset=="bigint"?_=C.BigInt(o)+e.firstOffset:_=o+e.firstOffset;for(let A=0;AFT(i,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),VT=(i,e)=>{for(let t=0;t{let e=[];return oT(i,jT,(t,s,r,n)=>{e=e.concat(t.playlists||[])}),e},Yc=({playlist:i,mediaSequence:e})=>{i.mediaSequence=e,i.segments.forEach((t,s)=>{t.number=i.mediaSequence+s})},zT=({oldPlaylists:i,newPlaylists:e,timelineStarts:t})=>{e.forEach(s=>{s.discontinuitySequence=t.findIndex(function({timeline:u}){return u===s.timeline});const r=VT(i,s.attributes.NAME);if(!r||s.sidx)return;const n=s.segments[0],a=r.segments.findIndex(function(u){return Math.abs(u.presentationTime-n.presentationTime)r.timeline||r.segments.length&&s.timeline>r.segments[r.segments.length-1].timeline)&&s.discontinuitySequence--;return}r.segments[a].discontinuity&&!n.discontinuity&&(n.discontinuity=!0,s.discontinuityStarts.unshift(0),s.discontinuitySequence--),Yc({playlist:s,mediaSequence:r.segments[a].number})})},WT=({oldManifest:i,newManifest:e})=>{const t=i.playlists.concat(Kc(i)),s=e.playlists.concat(Kc(e));return e.timelineStarts=lf([i.timelineStarts,e.timelineStarts]),zT({oldPlaylists:t,newPlaylists:s,timelineStarts:e.timelineStarts}),e},ca=i=>i&&i.uri+"-"+UT(i.byterange),po=i=>{const e=i.reduce(function(s,r){return s[r.attributes.baseUrl]||(s[r.attributes.baseUrl]=[]),s[r.attributes.baseUrl].push(r),s},{});let t=[];return Object.values(e).forEach(s=>{const r=nf(s.reduce((n,a)=>{const o=a.attributes.id+(a.attributes.lang||"");return n[o]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),n[o].segments.push(...a.segments)),a.attributes.contentProtection&&(n[o].attributes.contentProtection=a.attributes.contentProtection)):(n[o]=a,n[o].attributes.timelineStarts=[]),n[o].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),n},{}));t=t.concat(r)}),t.map(s=>(s.discontinuityStarts=BT(s.segments||[],"discontinuity"),s))},Fl=(i,e)=>{const t=ca(i.sidx),s=t&&e[t]&&e[t].sidx;return s&&Bl(i,s,i.sidx.resolvedUri),i},GT=(i,e={})=>{if(!Object.keys(e).length)return i;for(const t in i)i[t]=Fl(i[t],e);return i},XT=({attributes:i,segments:e,sidx:t,mediaSequence:s,discontinuitySequence:r,discontinuityStarts:n},a)=>{const o={attributes:{NAME:i.id,BANDWIDTH:i.bandwidth,CODECS:i.codecs,"PROGRAM-ID":1},uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,discontinuitySequence:r,discontinuityStarts:n,timelineStarts:i.timelineStarts,mediaSequence:s,segments:e};return i.contentProtection&&(o.contentProtection=i.contentProtection),i.serviceLocation&&(o.attributes.serviceLocation=i.serviceLocation),t&&(o.sidx=t),a&&(o.attributes.AUDIO="audio",o.attributes.SUBTITLES="subs"),o},KT=({attributes:i,segments:e,mediaSequence:t,discontinuityStarts:s,discontinuitySequence:r})=>{typeof e>"u"&&(e=[{uri:i.baseUrl,timeline:i.periodStart,resolvedUri:i.baseUrl||"",duration:i.sourceDuration,number:0}],i.duration=i.sourceDuration);const n={NAME:i.id,BANDWIDTH:i.bandwidth,"PROGRAM-ID":1};i.codecs&&(n.CODECS=i.codecs);const a={attributes:n,uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,timelineStarts:i.timelineStarts,discontinuityStarts:s,discontinuitySequence:r,mediaSequence:t,segments:e};return i.serviceLocation&&(a.attributes.serviceLocation=i.serviceLocation),a},QT=(i,e={},t=!1)=>{let s;const r=i.reduce((n,a)=>{const o=a.attributes.role&&a.attributes.role.value||"",u=a.attributes.lang||"";let c=a.attributes.label||"main";if(u&&!a.attributes.label){const y=o?` (${o})`:"";c=`${a.attributes.lang}${y}`}n[c]||(n[c]={language:u,autoselect:!0,default:o==="main",playlists:[],uri:""});const p=Fl(XT(a,t),e);return n[c].playlists.push(p),typeof s>"u"&&o==="main"&&(s=a,s.default=!0),n},{});if(!s){const n=Object.keys(r)[0];r[n].default=!0}return r},JT=(i,e={})=>i.reduce((t,s)=>{const r=s.attributes.label||s.attributes.lang||"text",n=s.attributes.lang||"und";return t[r]||(t[r]={language:n,default:!1,autoselect:!1,playlists:[],uri:""}),t[r].playlists.push(Fl(KT(s),e)),t},{}),ZT=i=>i.reduce((e,t)=>(t&&t.forEach(s=>{const{channel:r,language:n}=s;e[n]={autoselect:!1,default:!1,instreamId:r,language:n},s.hasOwnProperty("aspectRatio")&&(e[n].aspectRatio=s.aspectRatio),s.hasOwnProperty("easyReader")&&(e[n].easyReader=s.easyReader),s.hasOwnProperty("3D")&&(e[n]["3D"]=s["3D"])}),e),{}),eb=({attributes:i,segments:e,sidx:t,discontinuityStarts:s})=>{const r={attributes:{NAME:i.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:i.width,height:i.height},CODECS:i.codecs,BANDWIDTH:i.bandwidth,"PROGRAM-ID":1},uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,discontinuityStarts:s,timelineStarts:i.timelineStarts,segments:e};return i.frameRate&&(r.attributes["FRAME-RATE"]=i.frameRate),i.contentProtection&&(r.contentProtection=i.contentProtection),i.serviceLocation&&(r.attributes.serviceLocation=i.serviceLocation),t&&(r.sidx=t),r},tb=({attributes:i})=>i.mimeType==="video/mp4"||i.mimeType==="video/webm"||i.contentType==="video",ib=({attributes:i})=>i.mimeType==="audio/mp4"||i.mimeType==="audio/webm"||i.contentType==="audio",sb=({attributes:i})=>i.mimeType==="text/vtt"||i.contentType==="text",rb=(i,e)=>{i.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:s}){return s===t.timeline}),t.segments&&t.segments.forEach((s,r)=>{s.number=r})})},Qc=i=>i?Object.keys(i).reduce((e,t)=>{const s=i[t];return e.concat(s.playlists)},[]):[],nb=({dashPlaylists:i,locations:e,contentSteering:t,sidxMapping:s={},previousManifest:r,eventStream:n})=>{if(!i.length)return{};const{sourceDuration:a,type:o,suggestedPresentationDelay:u,minimumUpdatePeriod:c}=i[0].attributes,p=po(i.filter(tb)).map(eb),y=po(i.filter(ib)),T=po(i.filter(sb)),x=i.map(O=>O.attributes.captionServices).filter(Boolean),S={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:GT(p,s)};c>=0&&(S.minimumUpdatePeriod=c*1e3),e&&(S.locations=e),t&&(S.contentSteering=t),o==="dynamic"&&(S.suggestedPresentationDelay=u),n&&n.length>0&&(S.eventStream=n);const _=S.playlists.length===0,A=y.length?QT(y,s,_):null,D=T.length?JT(T,s):null,P=p.concat(Qc(A),Qc(D)),k=P.map(({timelineStarts:O})=>O);return S.timelineStarts=lf(k),rb(P,S.timelineStarts),A&&(S.mediaGroups.AUDIO.audio=A),D&&(S.mediaGroups.SUBTITLES.subs=D),x.length&&(S.mediaGroups["CLOSED-CAPTIONS"].cc=ZT(x)),r?WT({oldManifest:r,newManifest:S}):S},ab=(i,e,t)=>{const{NOW:s,clientOffset:r,availabilityStartTime:n,timescale:a=1,periodStart:o=0,minimumUpdatePeriod:u=0}=i,c=(s+r)/1e3,p=n+o,T=c+u-p;return Math.ceil((T*a-e)/t)},uf=(i,e)=>{const{type:t,minimumUpdatePeriod:s=0,media:r="",sourceDuration:n,timescale:a=1,startNumber:o=1,periodStart:u}=i,c=[];let p=-1;for(let y=0;yp&&(p=_);let A;if(S<0){const k=y+1;k===e.length?t==="dynamic"&&s>0&&r.indexOf("$Number$")>0?A=ab(i,p,x):A=(n*a-p)/x:A=(e[k].t-p)/x}else A=S+1;const D=o+c.length+A;let P=o+c.length;for(;P(e,t,s,r)=>{if(e==="$$")return"$";if(typeof i[t]>"u")return e;const n=""+i[t];return t==="RepresentationID"||(s?r=parseInt(r,10):r=1,n.length>=r)?n:`${new Array(r-n.length+1).join("0")}${n}`},Jc=(i,e)=>i.replace(ob,lb(e)),ub=(i,e)=>!i.duration&&!e?[{number:i.startNumber||1,duration:i.sourceDuration,time:0,timeline:i.periodStart}]:i.duration?Ml(i):uf(i,e),cb=(i,e)=>{const t={RepresentationID:i.id,Bandwidth:i.bandwidth||0},{initialization:s={sourceURL:"",range:""}}=i,r=yr({baseUrl:i.baseUrl,source:Jc(s.sourceURL,t),range:s.range});return ub(i,e).map(a=>{t.Number=a.number,t.Time=a.time;const o=Jc(i.media||"",t),u=i.timescale||1,c=i.presentationTimeOffset||0,p=i.periodStart+(a.time-c)/u;return{uri:o,timeline:a.timeline,duration:a.duration,resolvedUri:aa(i.baseUrl||"",o),map:r,number:a.number,presentationTime:p}})},db=(i,e)=>{const{baseUrl:t,initialization:s={}}=i,r=yr({baseUrl:t,source:s.sourceURL,range:s.range}),n=yr({baseUrl:t,source:e.media,range:e.mediaRange});return n.map=r,n},hb=(i,e)=>{const{duration:t,segmentUrls:s=[],periodStart:r}=i;if(!t&&!e||t&&e)throw new Error(ps.SEGMENT_TIME_UNSPECIFIED);const n=s.map(u=>db(i,u));let a;return t&&(a=Ml(i)),e&&(a=uf(i,e)),a.map((u,c)=>{if(n[c]){const p=n[c],y=i.timescale||1,T=i.presentationTimeOffset||0;return p.timeline=u.timeline,p.duration=u.duration,p.number=u.number,p.presentationTime=r+(u.time-T)/y,p}}).filter(u=>u)},fb=({attributes:i,segmentInfo:e})=>{let t,s;e.template?(s=cb,t=Ie(i,e.template)):e.base?(s=of,t=Ie(i,e.base)):e.list&&(s=hb,t=Ie(i,e.list));const r={attributes:i};if(!s)return r;const n=s(t,e.segmentTimeline);if(t.duration){const{duration:a,timescale:o=1}=t;t.duration=a/o}else n.length?t.duration=n.reduce((a,o)=>Math.max(a,Math.ceil(o.duration)),0):t.duration=0;return r.attributes=t,r.segments=n,e.base&&t.indexRange&&(r.sidx=n[0],r.segments=[]),r},pb=i=>i.map(fb),ye=(i,e)=>af(i.childNodes).filter(({tagName:t})=>t===e),Dr=i=>i.textContent.trim(),mb=i=>parseFloat(i.split("/").reduce((e,t)=>e/t)),Wi=i=>{const o=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(i);if(!o)return 0;const[u,c,p,y,T,x]=o.slice(1);return parseFloat(u||0)*31536e3+parseFloat(c||0)*2592e3+parseFloat(p||0)*86400+parseFloat(y||0)*3600+parseFloat(T||0)*60+parseFloat(x||0)},gb=i=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(i)&&(i+="Z"),Date.parse(i)),Zc={mediaPresentationDuration(i){return Wi(i)},availabilityStartTime(i){return gb(i)/1e3},minimumUpdatePeriod(i){return Wi(i)},suggestedPresentationDelay(i){return Wi(i)},type(i){return i},timeShiftBufferDepth(i){return Wi(i)},start(i){return Wi(i)},width(i){return parseInt(i,10)},height(i){return parseInt(i,10)},bandwidth(i){return parseInt(i,10)},frameRate(i){return mb(i)},startNumber(i){return parseInt(i,10)},timescale(i){return parseInt(i,10)},presentationTimeOffset(i){return parseInt(i,10)},duration(i){const e=parseInt(i,10);return isNaN(e)?Wi(i):e},d(i){return parseInt(i,10)},t(i){return parseInt(i,10)},r(i){return parseInt(i,10)},presentationTime(i){return parseInt(i,10)},DEFAULT(i){return i}},Ae=i=>i&&i.attributes?af(i.attributes).reduce((e,t)=>{const s=Zc[t.name]||Zc.DEFAULT;return e[t.name]=s(t.value),e},{}):{},yb={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},da=(i,e)=>e.length?fs(i.map(function(t){return e.map(function(s){const r=Dr(s),n=aa(t.baseUrl,r),a=Ie(Ae(s),{baseUrl:n});return n!==r&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):i,Ul=i=>{const e=ye(i,"SegmentTemplate")[0],t=ye(i,"SegmentList")[0],s=t&&ye(t,"SegmentURL").map(y=>Ie({tag:"SegmentURL"},Ae(y))),r=ye(i,"SegmentBase")[0],n=t||e,a=n&&ye(n,"SegmentTimeline")[0],o=t||r||e,u=o&&ye(o,"Initialization")[0],c=e&&Ae(e);c&&u?c.initialization=u&&Ae(u):c&&c.initialization&&(c.initialization={sourceURL:c.initialization});const p={template:c,segmentTimeline:a&&ye(a,"S").map(y=>Ae(y)),list:t&&Ie(Ae(t),{segmentUrls:s,initialization:Ae(u)}),base:r&&Ie(Ae(r),{initialization:Ae(u)})};return Object.keys(p).forEach(y=>{p[y]||delete p[y]}),p},_b=(i,e,t)=>s=>{const r=ye(s,"BaseURL"),n=da(e,r),a=Ie(i,Ae(s)),o=Ul(s);return n.map(u=>({segmentInfo:Ie(t,o),attributes:Ie(a,u)}))},Tb=i=>i.reduce((e,t)=>{const s=Ae(t);s.schemeIdUri&&(s.schemeIdUri=s.schemeIdUri.toLowerCase());const r=yb[s.schemeIdUri];if(r){e[r]={attributes:s};const n=ye(t,"cenc:pssh")[0];if(n){const a=Dr(n);e[r].pssh=a&&xh(a)}}return e},{}),bb=i=>{if(i.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof i.value!="string"?[]:i.value.split(";")).map(t=>{let s,r;return r=t,/^CC\d=/.test(t)?[s,r]=t.split("="):/^CC\d$/.test(t)&&(s=t),{channel:s,language:r}});if(i.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof i.value!="string"?[]:i.value.split(";")).map(t=>{const s={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(t)){const[r,n=""]=t.split("=");s.channel=r,s.language=t,n.split(",").forEach(a=>{const[o,u]=a.split(":");o==="lang"?s.language=u:o==="er"?s.easyReader=Number(u):o==="war"?s.aspectRatio=Number(u):o==="3D"&&(s["3D"]=Number(u))})}else s.language=t;return s.channel&&(s.channel="SERVICE"+s.channel),s})},vb=i=>fs(ye(i.node,"EventStream").map(e=>{const t=Ae(e),s=t.schemeIdUri;return ye(e,"Event").map(r=>{const n=Ae(r),a=n.presentationTime||0,o=t.timescale||1,u=n.duration||0,c=a/o+i.attributes.start;return{schemeIdUri:s,value:t.value,id:n.id,start:c,end:c+u/o,messageData:Dr(r)||n.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),Sb=(i,e,t)=>s=>{const r=Ae(s),n=da(e,ye(s,"BaseURL")),a=ye(s,"Role")[0],o={role:Ae(a)};let u=Ie(i,r,o);const c=ye(s,"Accessibility")[0],p=bb(Ae(c));p&&(u=Ie(u,{captionServices:p}));const y=ye(s,"Label")[0];if(y&&y.childNodes.length){const A=y.childNodes[0].nodeValue.trim();u=Ie(u,{label:A})}const T=Tb(ye(s,"ContentProtection"));Object.keys(T).length&&(u=Ie(u,{contentProtection:T}));const x=Ul(s),S=ye(s,"Representation"),_=Ie(t,x);return fs(S.map(_b(u,n,_)))},xb=(i,e)=>(t,s)=>{const r=da(e,ye(t.node,"BaseURL")),n=Ie(i,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(n.periodDuration=t.attributes.duration);const a=ye(t.node,"AdaptationSet"),o=Ul(t.node);return fs(a.map(Sb(n,r,o)))},Eb=(i,e)=>{if(i.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!i.length)return null;const t=Ie({serverURL:Dr(i[0])},Ae(i[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},Cb=({attributes:i,priorPeriodAttributes:e,mpdType:t})=>typeof i.start=="number"?i.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&t==="static"?0:null,wb=(i,e={})=>{const{manifestUri:t="",NOW:s=Date.now(),clientOffset:r=0,eventHandler:n=function(){}}=e,a=ye(i,"Period");if(!a.length)throw new Error(ps.INVALID_NUMBER_OF_PERIOD);const o=ye(i,"Location"),u=Ae(i),c=da([{baseUrl:t}],ye(i,"BaseURL")),p=ye(i,"ContentSteering");u.type=u.type||"static",u.sourceDuration=u.mediaPresentationDuration||0,u.NOW=s,u.clientOffset=r,o.length&&(u.locations=o.map(Dr));const y=[];return a.forEach((T,x)=>{const S=Ae(T),_=y[x-1];S.start=Cb({attributes:S,priorPeriodAttributes:_?_.attributes:null,mpdType:u.type}),y.push({node:T,attributes:S})}),{locations:u.locations,contentSteeringInfo:Eb(p,n),representationInfo:fs(y.map(xb(u,c))),eventStream:fs(y.map(vb))}},cf=i=>{if(i==="")throw new Error(ps.DASH_EMPTY_MANIFEST);const e=new NT;let t,s;try{t=e.parseFromString(i,"application/xml"),s=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!s||s&&s.getElementsByTagName("parsererror").length>0)throw new Error(ps.DASH_INVALID_XML);return s},Ab=i=>{const e=ye(i,"UTCTiming")[0];if(!e)return null;const t=Ae(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(ps.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},Db=(i,e={})=>{const t=wb(cf(i),e),s=pb(t.representationInfo);return nb({dashPlaylists:s,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},kb=i=>Ab(cf(i));var Ib=Math.pow(2,32),Pb=function(i){var e=new DataView(i.buffer,i.byteOffset,i.byteLength),t;return e.getBigUint64?(t=e.getBigUint64(0),t0;s+=12,r--)t.references.push({referenceType:(i[s]&128)>>>7,referencedSize:e.getUint32(s)&2147483647,subsegmentDuration:e.getUint32(s+4),startsWithSap:!!(i[s+8]&128),sapType:(i[s+8]&112)>>>4,sapDeltaTime:e.getUint32(s+8)&268435455});return t},Rb=Lb;const Nb=xr(Rb);var Mb=G([73,68,51]),Bb=function(e,t){t===void 0&&(t=0),e=G(e);var s=e[t+5],r=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],n=(s&16)>>4;return n?r+20:r+10},rr=function i(e,t){return t===void 0&&(t=0),e=G(e),e.length-t<10||!ge(e,Mb,{offset:t})?t:(t+=Bb(e,t),i(e,t))},td=function(e){return typeof e=="string"?Dh(e):e},Fb=function(e){return Array.isArray(e)?e.map(function(t){return td(t)}):[td(e)]},Ub=function i(e,t,s){s===void 0&&(s=!1),t=Fb(t),e=G(e);var r=[];if(!t.length)return r;for(var n=0;n>>0,o=e.subarray(n+4,n+8);if(a===0)break;var u=n+a;if(u>e.length){if(s)break;u=e.length}var c=e.subarray(n+8,u);ge(o,t[0])&&(t.length===1?r.push(c):r.push.apply(r,i(c,t.slice(1),s))),n=u}return r},mn={EBML:G([26,69,223,163]),DocType:G([66,130]),Segment:G([24,83,128,103]),SegmentInfo:G([21,73,169,102]),Tracks:G([22,84,174,107]),Track:G([174]),TrackNumber:G([215]),DefaultDuration:G([35,227,131]),TrackEntry:G([174]),TrackType:G([131]),FlagDefault:G([136]),CodecID:G([134]),CodecPrivate:G([99,162]),VideoTrack:G([224]),AudioTrack:G([225]),Cluster:G([31,67,182,117]),Timestamp:G([231]),TimestampScale:G([42,215,177]),BlockGroup:G([160]),BlockDuration:G([155]),Block:G([161]),SimpleBlock:G([163])},Fo=[128,64,32,16,8,4,2,1],qb=function(e){for(var t=1,s=0;s=t.length)return t.length;var r=Nn(t,s,!1);if(ge(e.bytes,r.bytes))return s;var n=Nn(t,s+r.length);return i(e,t,s+n.length+n.value+r.length)},sd=function i(e,t){t=$b(t),e=G(e);var s=[];if(!t.length)return s;for(var r=0;re.length?e.length:o+a.value,c=e.subarray(o,u);ge(t[0],n.bytes)&&(t.length===1?s.push(c):s=s.concat(i(c,t.slice(1))));var p=n.length+a.length+c.length;r+=p}return s},Hb=G([0,0,0,1]),Vb=G([0,0,1]),zb=G([0,0,3]),Wb=function(e){for(var t=[],s=1;s>1&63),s.indexOf(c)!==-1&&(a=n+u),n+=u+(t==="h264"?1:2)}return e.subarray(0,0)},Gb=function(e,t,s){return df(e,"h264",t,s)},Xb=function(e,t,s){return df(e,"h265",t,s)},je={webm:G([119,101,98,109]),matroska:G([109,97,116,114,111,115,107,97]),flac:G([102,76,97,67]),ogg:G([79,103,103,83]),ac3:G([11,119]),riff:G([82,73,70,70]),avi:G([65,86,73]),wav:G([87,65,86,69]),"3gp":G([102,116,121,112,51,103]),mp4:G([102,116,121,112]),fmp4:G([115,116,121,112]),mov:G([102,116,121,112,113,116]),moov:G([109,111,111,118]),moof:G([109,111,111,102])},ms={aac:function(e){var t=rr(e);return ge(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=rr(e);return ge(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=sd(e,[mn.EBML,mn.DocType])[0];return ge(t,je.webm)},mkv:function(e){var t=sd(e,[mn.EBML,mn.DocType])[0];return ge(t,je.matroska)},mp4:function(e){if(ms["3gp"](e)||ms.mov(e))return!1;if(ge(e,je.mp4,{offset:4})||ge(e,je.fmp4,{offset:4})||ge(e,je.moof,{offset:4})||ge(e,je.moov,{offset:4}))return!0},mov:function(e){return ge(e,je.mov,{offset:4})},"3gp":function(e){return ge(e,je["3gp"],{offset:4})},ac3:function(e){var t=rr(e);return ge(e,je.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var t=0;t+1880},Ei={};/** * @license * Video.js 8.23.3 * Copyright Brightcove, Inc. * Available under Apache License Version 2.0 * * * Includes vtt.js * Available under Apache License Version 2.0 * */var qo="8.23.3";const $t={},ci=function(i,e){return $t[i]=$t[i]||[],e&&($t[i]=$t[i].concat(e)),$t[i]},Qb=function(i,e){ci(i,e)},hf=function(i,e){const t=ci(i).indexOf(e);return t<=-1?!1:($t[i]=$t[i].slice(),$t[i].splice(t,1),!0)},Jb=function(i,e){ci(i,[].concat(e).map(t=>{const s=(...r)=>(hf(i,s),t(...r));return s}))},Mn={prefixed:!0},Sn=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],rd=Sn[0];let nr;for(let i=0;i(s,r,n)=>{const a=e.levels[r],o=new RegExp(`^(${a})$`);let u=i;if(s!=="log"&&n.unshift(s.toUpperCase()+":"),t&&(u=`%c${i}`,n.unshift(t)),n.unshift(u+":"),Ge){Ge.push([].concat(n));const p=Ge.length-1e3;Ge.splice(0,p>0?p:0)}if(!C.console)return;let c=C.console[s];!c&&s==="debug"&&(c=C.console.info||C.console.log),!(!c||!a||!o.test(s))&&c[Array.isArray(n)?"apply":"call"](C.console,n)};function $o(i,e=":",t=""){let s="info",r;function n(...a){r("log",s,a)}return r=Zb(i,n,t),n.createLogger=(a,o,u)=>{const c=o!==void 0?o:e,p=u!==void 0?u:t,y=`${i} ${c} ${a}`;return $o(y,c,p)},n.createNewLogger=(a,o,u)=>$o(a,o,u),n.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:s},n.level=a=>{if(typeof a=="string"){if(!n.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);s=a}return s},n.history=()=>Ge?[].concat(Ge):[],n.history.filter=a=>(Ge||[]).filter(o=>new RegExp(`.*${a}.*`).test(o[0])),n.history.clear=()=>{Ge&&(Ge.length=0)},n.history.disable=()=>{Ge!==null&&(Ge.length=0,Ge=null)},n.history.enable=()=>{Ge===null&&(Ge=[])},n.error=(...a)=>r("error",s,a),n.warn=(...a)=>r("warn",s,a),n.debug=(...a)=>r("debug",s,a),n}const Z=$o("VIDEOJS"),ff=Z.createLogger,ev=Object.prototype.toString,pf=function(i){return Rt(i)?Object.keys(i):[]};function Zi(i,e){pf(i).forEach(t=>e(i[t],t))}function mf(i,e,t=0){return pf(i).reduce((s,r)=>e(s,i[r],r),t)}function Rt(i){return!!i&&typeof i=="object"}function gs(i){return Rt(i)&&ev.call(i)==="[object Object]"&&i.constructor===Object}function ue(...i){const e={};return i.forEach(t=>{t&&Zi(t,(s,r)=>{if(!gs(s)){e[r]=s;return}gs(e[r])||(e[r]={}),e[r]=ue(e[r],s)})}),e}function gf(i={}){const e=[];for(const t in i)if(i.hasOwnProperty(t)){const s=i[t];e.push(s)}return e}function ha(i,e,t,s=!0){const r=a=>Object.defineProperty(i,e,{value:a,enumerable:!0,writable:!0}),n={configurable:!0,enumerable:!0,get(){const a=t();return r(a),a}};return s&&(n.set=r),Object.defineProperty(i,e,n)}var tv=Object.freeze({__proto__:null,each:Zi,reduce:mf,isObject:Rt,isPlain:gs,merge:ue,values:gf,defineLazyProperty:ha});let $l=!1,yf=null,Tt=!1,_f,Tf=!1,es=!1,ts=!1,Nt=!1,jl=null,fa=null;const iv=!!(C.cast&&C.cast.framework&&C.cast.framework.CastReceiverContext);let bf=null,Bn=!1,pa=!1,Fn=!1,ma=!1,Un=!1,qn=!1,$n=!1;const _r=!!(Ss()&&("ontouchstart"in C||C.navigator.maxTouchPoints||C.DocumentTouch&&C.document instanceof C.DocumentTouch)),ii=C.navigator&&C.navigator.userAgentData;ii&&ii.platform&&ii.brands&&(Tt=ii.platform==="Android",es=!!ii.brands.find(i=>i.brand==="Microsoft Edge"),ts=!!ii.brands.find(i=>i.brand==="Chromium"),Nt=!es&&ts,jl=fa=(ii.brands.find(i=>i.brand==="Chromium")||{}).version||null,pa=ii.platform==="Windows");if(!ts){const i=C.navigator&&C.navigator.userAgent||"";$l=/iPod/i.test(i),yf=function(){const e=i.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),Tt=/Android/i.test(i),_f=function(){const e=i.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),s=e[2]&&parseFloat(e[2]);return t&&s?parseFloat(e[1]+"."+e[2]):t||null}(),Tf=/Firefox/i.test(i),es=/Edg/i.test(i),ts=/Chrome/i.test(i)||/CriOS/i.test(i),Nt=!es&&ts,jl=fa=function(){const e=i.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),bf=function(){const e=/MSIE\s(\d+)\.\d/.exec(i);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(i)&&/rv:11.0/.test(i)&&(t=11),t}(),Un=/Tizen/i.test(i),qn=/Web0S/i.test(i),$n=Un||qn,Bn=/Safari/i.test(i)&&!Nt&&!Tt&&!es&&!$n,pa=/Windows/i.test(i),Fn=/iPad/i.test(i)||Bn&&_r&&!/iPhone/i.test(i),ma=/iPhone/i.test(i)&&!Fn}const Ne=ma||Fn||$l,ga=(Bn||Ne)&&!Nt;var vf=Object.freeze({__proto__:null,get IS_IPOD(){return $l},get IOS_VERSION(){return yf},get IS_ANDROID(){return Tt},get ANDROID_VERSION(){return _f},get IS_FIREFOX(){return Tf},get IS_EDGE(){return es},get IS_CHROMIUM(){return ts},get IS_CHROME(){return Nt},get CHROMIUM_VERSION(){return jl},get CHROME_VERSION(){return fa},IS_CHROMECAST_RECEIVER:iv,get IE_VERSION(){return bf},get IS_SAFARI(){return Bn},get IS_WINDOWS(){return pa},get IS_IPAD(){return Fn},get IS_IPHONE(){return ma},get IS_TIZEN(){return Un},get IS_WEBOS(){return qn},get IS_SMART_TV(){return $n},TOUCH_ENABLED:_r,IS_IOS:Ne,IS_ANY_SAFARI:ga});function nd(i){return typeof i=="string"&&!!i.trim()}function sv(i){if(i.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Ss(){return j===C.document}function xs(i){return Rt(i)&&i.nodeType===1}function Sf(){try{return C.parent!==C.self}catch{return!0}}function xf(i){return function(e,t){if(!nd(e))return j[i](null);nd(t)&&(t=j.querySelector(t));const s=xs(t)?t:j;return s[i]&&s[i](e)}}function K(i="div",e={},t={},s){const r=j.createElement(i);return Object.getOwnPropertyNames(e).forEach(function(n){const a=e[n];n==="textContent"?fi(r,a):(r[n]!==a||n==="tabIndex")&&(r[n]=a)}),Object.getOwnPropertyNames(t).forEach(function(n){r.setAttribute(n,t[n])}),s&&Hl(r,s),r}function fi(i,e){return typeof i.textContent>"u"?i.innerText=e:i.textContent=e,i}function jo(i,e){e.firstChild?e.insertBefore(i,e.firstChild):e.appendChild(i)}function ur(i,e){return sv(e),i.classList.contains(e)}function ki(i,...e){return i.classList.add(...e.reduce((t,s)=>t.concat(s.split(/\s+/)),[])),i}function ya(i,...e){return i?(i.classList.remove(...e.reduce((t,s)=>t.concat(s.split(/\s+/)),[])),i):(Z.warn("removeClass was called with an element that doesn't exist"),null)}function Ef(i,e,t){return typeof t=="function"&&(t=t(i,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(s=>i.classList.toggle(s,t)),i}function Cf(i,e){Object.getOwnPropertyNames(e).forEach(function(t){const s=e[t];s===null||typeof s>"u"||s===!1?i.removeAttribute(t):i.setAttribute(t,s===!0?"":s)})}function ni(i){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(i&&i.attributes&&i.attributes.length>0){const s=i.attributes;for(let r=s.length-1;r>=0;r--){const n=s[r].name;let a=s[r].value;t.includes(n)&&(a=a!==null),e[n]=a}}return e}function wf(i,e){return i.getAttribute(e)}function ys(i,e,t){i.setAttribute(e,t)}function _a(i,e){i.removeAttribute(e)}function Af(){j.body.focus(),j.onselectstart=function(){return!1}}function Df(){j.onselectstart=function(){return!0}}function _s(i){if(i&&i.getBoundingClientRect&&i.parentNode){const e=i.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(s=>{e[s]!==void 0&&(t[s]=e[s])}),t.height||(t.height=parseFloat(Ts(i,"height"))),t.width||(t.width=parseFloat(Ts(i,"width"))),t}}function Tr(i){if(!i||i&&!i.offsetParent)return{left:0,top:0,width:0,height:0};const e=i.offsetWidth,t=i.offsetHeight;let s=0,r=0;for(;i.offsetParent&&i!==j[Mn.fullscreenElement];)s+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;return{left:s,top:r,width:e,height:t}}function Ta(i,e){const t={x:0,y:0};if(Ne){let p=i;for(;p&&p.nodeName.toLowerCase()!=="html";){const y=Ts(p,"transform");if(/^matrix/.test(y)){const T=y.slice(7,-1).split(/,\s/).map(Number);t.x+=T[4],t.y+=T[5]}else if(/^matrix3d/.test(y)){const T=y.slice(9,-1).split(/,\s/).map(Number);t.x+=T[12],t.y+=T[13]}if(p.assignedSlot&&p.assignedSlot.parentElement&&C.WebKitCSSMatrix){const T=C.getComputedStyle(p.assignedSlot.parentElement).transform,x=new C.WebKitCSSMatrix(T);t.x+=x.m41,t.y+=x.m42}p=p.parentNode||p.host}}const s={},r=Tr(e.target),n=Tr(i),a=n.width,o=n.height;let u=e.offsetY-(n.top-r.top),c=e.offsetX-(n.left-r.left);return e.changedTouches&&(c=e.changedTouches[0].pageX-n.left,u=e.changedTouches[0].pageY+n.top,Ne&&(c-=t.x,u-=t.y)),s.y=1-Math.max(0,Math.min(1,u/o)),s.x=Math.max(0,Math.min(1,c/a)),s}function kf(i){return Rt(i)&&i.nodeType===3}function ba(i){for(;i.firstChild;)i.removeChild(i.firstChild);return i}function If(i){return typeof i=="function"&&(i=i()),(Array.isArray(i)?i:[i]).map(e=>{if(typeof e=="function"&&(e=e()),xs(e)||kf(e))return e;if(typeof e=="string"&&/\S/.test(e))return j.createTextNode(e)}).filter(e=>e)}function Hl(i,e){return If(e).forEach(t=>i.appendChild(t)),i}function Pf(i,e){return Hl(ba(i),e)}function br(i){return i.button===void 0&&i.buttons===void 0||i.button===0&&i.buttons===void 0||i.type==="mouseup"&&i.button===0&&i.buttons===0||i.type==="mousedown"&&i.button===0&&i.buttons===0?!0:!(i.button!==0||i.buttons!==1)}const di=xf("querySelector"),Of=xf("querySelectorAll");function Ts(i,e){if(!i||!e)return"";if(typeof C.getComputedStyle=="function"){let t;try{t=C.getComputedStyle(i)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function Lf(i){[...j.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(r=>r.cssText).join(""),s=j.createElement("style");s.textContent=t,i.document.head.appendChild(s)}catch{const s=j.createElement("link");s.rel="stylesheet",s.type=e.type,s.media=e.media.mediaText,s.href=e.href,i.document.head.appendChild(s)}})}var Rf=Object.freeze({__proto__:null,isReal:Ss,isEl:xs,isInFrame:Sf,createEl:K,textContent:fi,prependTo:jo,hasClass:ur,addClass:ki,removeClass:ya,toggleClass:Ef,setAttributes:Cf,getAttributes:ni,getAttribute:wf,setAttribute:ys,removeAttribute:_a,blockTextSelection:Af,unblockTextSelection:Df,getBoundingClientRect:_s,findPosition:Tr,getPointerPosition:Ta,isTextNode:kf,emptyEl:ba,normalizeContent:If,appendContent:Hl,insertContent:Pf,isSingleLeftClick:br,$:di,$$:Of,computedStyle:Ts,copyStyleSheetsToWindow:Lf});let Nf=!1,Ho;const rv=function(){if(Ho.options.autoSetup===!1)return;const i=Array.prototype.slice.call(j.getElementsByTagName("video")),e=Array.prototype.slice.call(j.getElementsByTagName("audio")),t=Array.prototype.slice.call(j.getElementsByTagName("video-js")),s=i.concat(e,t);if(s&&s.length>0)for(let r=0,n=s.length;r-1&&(r={passive:!0}),i.addEventListener(e,s.dispatcher,r)}else i.attachEvent&&i.attachEvent("on"+e,s.dispatcher)}function Me(i,e,t){if(!ze.has(i))return;const s=ze.get(i);if(!s.handlers)return;if(Array.isArray(e))return Vl(Me,i,e,t);const r=function(a,o){s.handlers[o]=[],ad(a,o)};if(e===void 0){for(const a in s.handlers)Object.prototype.hasOwnProperty.call(s.handlers||{},a)&&r(i,a);return}const n=s.handlers[e];if(n){if(!t){r(i,e);return}if(t.guid)for(let a=0;a=e&&(i(...r),t=n)}},Ff=function(i,e,t,s=C){let r;const n=()=>{s.clearTimeout(r),r=null},a=function(){const o=this,u=arguments;let c=function(){r=null,c=null,t||i.apply(o,u)};!r&&t&&i.apply(o,u),s.clearTimeout(r),r=s.setTimeout(c,e)};return a.cancel=n,a};var cv=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:dt,bind_:he,throttle:Mt,debounce:Ff});let Qs;class ot{on(e,t){const s=this.addEventListener;this.addEventListener=()=>{},at(this,e,t),this.addEventListener=s}off(e,t){Me(this,e,t)}one(e,t){const s=this.addEventListener;this.addEventListener=()=>{},Sa(this,e,t),this.addEventListener=s}any(e,t){const s=this.addEventListener;this.addEventListener=()=>{},zl(this,e,t),this.addEventListener=s}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=va(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Es(this,e)}queueTrigger(e){Qs||(Qs=new Map);const t=e.type||e;let s=Qs.get(this);s||(s=new Map,Qs.set(this,s));const r=s.get(t);s.delete(t),C.clearTimeout(r);const n=C.setTimeout(()=>{s.delete(t),s.size===0&&(s=null,Qs.delete(this)),this.trigger(e)},0);s.set(t,n)}}ot.prototype.allowedEvents_={};ot.prototype.addEventListener=ot.prototype.on;ot.prototype.removeEventListener=ot.prototype.off;ot.prototype.dispatchEvent=ot.prototype.trigger;const xa=i=>typeof i.name=="function"?i.name():typeof i.name=="string"?i.name:i.name_?i.name_:i.constructor&&i.constructor.name?i.constructor.name:typeof i,Vt=i=>i instanceof ot||!!i.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof i[e]=="function"),dv=(i,e)=>{Vt(i)?e():(i.eventedCallbacks||(i.eventedCallbacks=[]),i.eventedCallbacks.push(e))},Wo=i=>typeof i=="string"&&/\S/.test(i)||Array.isArray(i)&&!!i.length,jn=(i,e,t)=>{if(!i||!i.nodeName&&!Vt(i))throw new Error(`Invalid target for ${xa(e)}#${t}; must be a DOM node or evented object.`)},Uf=(i,e,t)=>{if(!Wo(i))throw new Error(`Invalid event type for ${xa(e)}#${t}; must be a non-empty string or array.`)},qf=(i,e,t)=>{if(typeof i!="function")throw new Error(`Invalid listener for ${xa(e)}#${t}; must be a function.`)},mo=(i,e,t)=>{const s=e.length<3||e[0]===i||e[0]===i.eventBusEl_;let r,n,a;return s?(r=i.eventBusEl_,e.length>=3&&e.shift(),[n,a]=e):(r=e[0],n=e[1],a=e[2]),jn(r,i,t),Uf(n,i,t),qf(a,i,t),a=he(i,a),{isTargetingSelf:s,target:r,type:n,listener:a}},vi=(i,e,t,s)=>{jn(i,i,e),i.nodeName?uv[e](i,t,s):i[e](t,s)},hv={on(...i){const{isTargetingSelf:e,target:t,type:s,listener:r}=mo(this,i,"on");if(vi(t,"on",s,r),!e){const n=()=>this.off(t,s,r);n.guid=r.guid;const a=()=>this.off("dispose",n);a.guid=r.guid,vi(this,"on","dispose",n),vi(t,"on","dispose",a)}},one(...i){const{isTargetingSelf:e,target:t,type:s,listener:r}=mo(this,i,"one");if(e)vi(t,"one",s,r);else{const n=(...a)=>{this.off(t,s,n),r.apply(null,a)};n.guid=r.guid,vi(t,"one",s,n)}},any(...i){const{isTargetingSelf:e,target:t,type:s,listener:r}=mo(this,i,"any");if(e)vi(t,"any",s,r);else{const n=(...a)=>{this.off(t,s,n),r.apply(null,a)};n.guid=r.guid,vi(t,"any",s,n)}},off(i,e,t){if(!i||Wo(i))Me(this.eventBusEl_,i,e);else{const s=i,r=e;jn(s,this,"off"),Uf(r,this,"off"),qf(t,this,"off"),t=he(this,t),this.off("dispose",t),s.nodeName?(Me(s,r,t),Me(s,"dispose",t)):Vt(s)&&(s.off(r,t),s.off("dispose",t))}},trigger(i,e){jn(this.eventBusEl_,this,"trigger");const t=i&&typeof i!="string"?i.type:i;if(!Wo(t))throw new Error(`Invalid event type for ${xa(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return Es(this.eventBusEl_,i,e)}};function Wl(i,e={}){const{eventBusKey:t}=e;if(t){if(!i[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);i.eventBusEl_=i[t]}else i.eventBusEl_=K("span",{className:"vjs-event-bus"});return Object.assign(i,hv),i.eventedCallbacks&&i.eventedCallbacks.forEach(s=>{s()}),i.on("dispose",()=>{i.off(),[i,i.el_,i.eventBusEl_].forEach(function(s){s&&ze.has(s)&&ze.delete(s)}),C.setTimeout(()=>{i.eventBusEl_=null},0)}),i}const fv={state:{},setState(i){typeof i=="function"&&(i=i());let e;return Zi(i,(t,s)=>{this.state[s]!==t&&(e=e||{},e[s]={from:this.state[s],to:t}),this.state[s]=t}),e&&Vt(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function $f(i,e){return Object.assign(i,fv),i.state=Object.assign({},i.state,e),typeof i.handleStateChanged=="function"&&Vt(i)&&i.on("statechanged",i.handleStateChanged),i}const cr=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toLowerCase())},be=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toUpperCase())},jf=function(i,e){return be(i)===be(e)};var pv=Object.freeze({__proto__:null,toLowerCase:cr,toTitleCase:be,titleCaseEquals:jf});class B{constructor(e,t,s){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=ue({},this.options_),t=this.options_=ue(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const r=e&&e.id&&e.id()||"no_player";this.id_=`${r}_component_${ct()}`}this.name_=t.name||null,t.el?this.el_=t.el:t.createEl!==!1&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(r=>this.addClass(r)),["on","off","one","any","trigger"].forEach(r=>{this[r]=void 0}),t.evented!==!1&&(Wl(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),$f(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,t.initChildren!==!1&&this.initChildren(),this.ready(s),t.reportTouchActivity!==!1&&this.enableTouchActivity()}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let t=this.children_.length-1;t>=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return!!this.isDisposed_}player(){return this.player_}options(e){return e?(this.options_=ue(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,s){return K(e,t,s)}localize(e,t,s=e){const r=this.player_.language&&this.player_.language(),n=this.player_.languages&&this.player_.languages(),a=n&&n[r],o=r&&r.split("-")[0],u=n&&n[o];let c=s;return a&&a[e]?c=a[e]:u&&u[e]&&(c=u[e]),t&&(c=c.replace(/\{(\d+)\}/g,function(p,y){const T=t[y-1];let x=T;return typeof T>"u"&&(x=p),x})),c}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((s,r)=>s.concat(r),[]);let t=this;for(let s=0;s=0;r--)if(this.children_[r]===e){t=!0,this.children_.splice(r,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[be(e.name())]=null,this.childNameIndex_[cr(e.name())]=null;const s=e.el();s&&s.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,s=a=>{const o=a.name;let u=a.opts;if(t[o]!==void 0&&(u=t[o]),u===!1)return;u===!0&&(u={}),u.playerOptions=this.options_.playerOptions;const c=this.addChild(o,u);c&&(this[o]=c)};let r;const n=B.getComponent("Tech");Array.isArray(e)?r=e:r=Object.keys(e),r.concat(Object.keys(this.options_).filter(function(a){return!r.some(function(o){return typeof o=="string"?a===o:a===o.name})})).map(a=>{let o,u;return typeof a=="string"?(o=a,u=e[o]||this.options_[o]||{}):(o=a.name,u=a),{name:o,opts:u}}).filter(a=>{const o=B.getComponent(a.opts.componentClass||be(a.name));return o&&!n.isTech(o)}).forEach(s)}}buildCSSClass(){return""}ready(e,t=!1){if(e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}t?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)}$(e,t){return di(e,t||this.contentEl())}$$(e,t){return Of(e,t||this.contentEl())}hasClass(e){return ur(this.el_,e)}addClass(...e){ki(this.el_,...e)}removeClass(...e){ya(this.el_,...e)}toggleClass(e,t){Ef(this.el_,e,t)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return wf(this.el_,e)}setAttribute(e,t){ys(this.el_,e,t)}removeAttribute(e){_a(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,s){if(t!==void 0){(t===null||t!==t)&&(t=0),(""+t).indexOf("%")!==-1||(""+t).indexOf("px")!==-1?this.el_.style[e]=t:t==="auto"?this.el_.style[e]="":this.el_.style[e]=t+"px",s||this.trigger("componentresize");return}if(!this.el_)return 0;const r=this.el_.style[e],n=r.indexOf("px");return parseInt(n!==-1?r.slice(0,n):this.el_["offset"+be(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=Ts(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const s=`offset${be(e)}`;t=this.el_[s]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){const e=this.el_.getBoundingClientRect(),t={x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},s={x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2};return{boundingClientRect:t,center:s}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(e.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)&&e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const s=10,r=200;let n;this.on("touchstart",function(o){o.touches.length===1&&(t={pageX:o.touches[0].pageX,pageY:o.touches[0].pageY},e=C.performance.now(),n=!0)}),this.on("touchmove",function(o){if(o.touches.length>1)n=!1;else if(t){const u=o.touches[0].pageX-t.pageX,c=o.touches[0].pageY-t.pageY;Math.sqrt(u*u+c*c)>s&&(n=!1)}});const a=function(){n=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(o){t=null,n===!0&&C.performance.now()-e{this.setTimeoutIds_.has(s)&&this.setTimeoutIds_.delete(s),e()},t),this.setTimeoutIds_.add(s),s}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),C.clearTimeout(e)),e}setInterval(e,t){e=he(this,e),this.clearTimersOnDispose_();const s=C.setInterval(e,t);return this.setIntervalIds_.add(s),s}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),C.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=he(this,e),t=C.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=he(this,t);const s=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,s),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),C.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,t])=>{this[e].forEach((s,r)=>this[t](r))}),this.clearingTimersOnDispose_=!1}))}getIsDisabled(){return!!this.el_.disabled}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function t(n){const a=C.getComputedStyle(n,null),o=a.getPropertyValue("visibility");return a.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(o)}function s(n){return!(!t(n.parentElement)||!t(n)||n.style.opacity==="0"||C.getComputedStyle(n).height==="0px"||C.getComputedStyle(n).width==="0px")}function r(n){if(n.offsetWidth+n.offsetHeight+n.getBoundingClientRect().height+n.getBoundingClientRect().width===0)return!1;const a={x:n.getBoundingClientRect().left+n.offsetWidth/2,y:n.getBoundingClientRect().top+n.offsetHeight/2};if(a.x<0||a.x>(j.documentElement.clientWidth||C.innerWidth)||a.y<0||a.y>(j.documentElement.clientHeight||C.innerHeight))return!1;let o=j.elementFromPoint(a.x,a.y);for(;o;){if(o===n)return!0;if(o.parentNode)o=o.parentNode;else return!1}}return e||(e=this.el()),!!(r(e)&&s(e)&&(!e.parentElement||e.tabIndex>=0))}static registerComponent(e,t){if(typeof e!="string"||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const s=B.getComponent("Tech"),r=s&&s.isTech(t),n=B===t||B.prototype.isPrototypeOf(t.prototype);if(r||!n){let o;throw r?o="techs must be registered using Tech.registerTech()":o="must be a Component subclass",new Error(`Illegal component, "${e}"; ${o}.`)}e=be(e),B.components_||(B.components_={});const a=B.getComponent("Player");if(e==="Player"&&a&&a.players){const o=a.players,u=Object.keys(o);if(o&&u.length>0){for(let c=0;ct)throw new Error(`Failed to execute '${i}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function od(i,e,t,s){return mv(i,s,t.length-1),t[s][e]}function go(i){let e;return i===void 0||i.length===0?e={length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:e={length:i.length,start:od.bind(null,"start",0,i),end:od.bind(null,"end",1,i)},C.Symbol&&C.Symbol.iterator&&(e[C.Symbol.iterator]=()=>(i||[]).values()),e}function yt(i,e){return Array.isArray(i)?go(i):i===void 0||e===void 0?go():go([[i,e]])}const Hf=function(i,e){i=i<0?0:i;let t=Math.floor(i%60),s=Math.floor(i/60%60),r=Math.floor(i/3600);const n=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(i)||i===1/0)&&(r=s=t="-"),r=r>0||a>0?r+":":"",s=((r||n>=10)&&s<10?"0"+s:s)+":",t=t<10?"0"+t:t,r+s+t};let Gl=Hf;function Vf(i){Gl=i}function zf(){Gl=Hf}function Ni(i,e=i){return Gl(i,e)}var gv=Object.freeze({__proto__:null,createTimeRanges:yt,createTimeRange:yt,setFormatTime:Vf,resetFormatTime:zf,formatTime:Ni});function Wf(i,e){let t=0,s,r;if(!e)return 0;(!i||!i.length)&&(i=yt(0,0));for(let n=0;ne&&(r=e),t+=r-s;return t/e}function Te(i){if(i instanceof Te)return i;typeof i=="number"?this.code=i:typeof i=="string"?this.message=i:Rt(i)&&(typeof i.code=="number"&&(this.code=i.code),Object.assign(this,i)),this.message||(this.message=Te.defaultMessages[this.code]||"")}Te.prototype.code=0;Te.prototype.message="";Te.prototype.status=null;Te.prototype.metadata=null;Te.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];Te.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};Te.MEDIA_ERR_CUSTOM=0;Te.prototype.MEDIA_ERR_CUSTOM=0;Te.MEDIA_ERR_ABORTED=1;Te.prototype.MEDIA_ERR_ABORTED=1;Te.MEDIA_ERR_NETWORK=2;Te.prototype.MEDIA_ERR_NETWORK=2;Te.MEDIA_ERR_DECODE=3;Te.prototype.MEDIA_ERR_DECODE=3;Te.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Te.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Te.MEDIA_ERR_ENCRYPTED=5;Te.prototype.MEDIA_ERR_ENCRYPTED=5;function dr(i){return i!=null&&typeof i.then=="function"}function At(i){dr(i)&&i.then(null,e=>{})}const Go=function(i){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((t,s,r)=>(i[s]&&(t[s]=i[s]),t),{cues:i.cues&&Array.prototype.map.call(i.cues,function(t){return{startTime:t.startTime,endTime:t.endTime,text:t.text,id:t.id}})})},yv=function(i){const e=i.$$("track"),t=Array.prototype.map.call(e,r=>r.track);return Array.prototype.map.call(e,function(r){const n=Go(r.track);return r.src&&(n.src=r.src),n}).concat(Array.prototype.filter.call(i.textTracks(),function(r){return t.indexOf(r)===-1}).map(Go))},_v=function(i,e){return i.forEach(function(t){const s=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(r=>s.addCue(r))}),e.textTracks()};var Xo={textTracksToJson:yv,jsonToTextTracks:_v,trackToJson:Go};const yo="vjs-modal-dialog";class Cs extends B{constructor(e,t){super(e,t),this.handleKeyDown_=s=>this.handleKeyDown(s),this.close_=s=>this.close(s),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=K("div",{className:`${yo}-content`},{role:"document"}),this.descEl_=K("p",{className:`${yo}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),fi(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${yo} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(this.opened_){this.options_.fillAlways&&this.fill();return}const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){return typeof e=="boolean"&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const t=this.closeable_=!!e;let s=this.getChild("closeButton");if(t&&!s){const r=this.contentEl_;this.contentEl_=this.el_,s=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=r,this.on(s,"close",this.close_)}!t&&s&&(this.off(s,"close",this.close_),this.removeChild(s),s.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),s=t.parentNode,r=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,s.removeChild(t),this.empty(),Pf(t,e),this.trigger("modalfill"),r?s.insertBefore(t,r):s.appendChild(t);const n=this.getChild("closeButton");n&&s.appendChild(n.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),ba(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=j.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),e.key==="Escape"&&this.closeable()){e.preventDefault(),this.close();return}if(e.key!=="Tab")return;const t=this.focusableEls_(),s=this.el_.querySelector(":focus");let r;for(let n=0;n(t instanceof C.HTMLAnchorElement||t instanceof C.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof C.HTMLInputElement||t instanceof C.HTMLSelectElement||t instanceof C.HTMLTextAreaElement||t instanceof C.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof C.HTMLIFrameElement||t instanceof C.HTMLObjectElement||t instanceof C.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}Cs.prototype.options_={pauseOnOpen:!0,temporary:!0};B.registerComponent("ModalDialog",Cs);class Mi extends ot{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t{this.trigger({track:e,type:"labelchange",target:this})},Vt(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let s=0,r=this.length;s=0;t--)if(e[t].enabled){_o(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&_o(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,_o(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const To=function(i,e){for(let t=0;t=0;t--)if(e[t].selected){To(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let t=0;t{this.changing_||(this.changing_=!0,To(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class Xl extends Mi{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}toJSON(){return this.tracks_.map(e=>e.toJSON())}}class Tv{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,s=e.length;t0&&(C.console&&C.console.groupCollapsed&&C.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),s.forEach(r=>Z.error(r)),C.console&&C.console.groupEnd&&C.console.groupEnd()),t.flush()},cd=function(i,e){const t={uri:i},s=Ea(i);s&&(t.cors=s);const r=e.tech_.crossOrigin()==="use-credentials";r&&(t.withCredentials=r),Th(t,he(this,function(n,a,o){if(n)return Z.error(n,a);e.loaded_=!0,typeof C.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],u=>{if(u.type==="vttjserror"){Z.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return ud(o,e)}):ud(o,e)}))};class kr extends Kl{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=ue(e,{kind:Sv[e.kind]||"subtitles",language:e.language||e.srclang||""});let s=ld[t.mode]||"disabled";const r=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(s="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const n=new Hn(this.cues_),a=new Hn(this.activeCues_);let o=!1;this.timeupdateHandler=he(this,function(c={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){c.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,o&&(this.trigger("cuechange"),o=!1),c.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const u=()=>{this.stopTracking()};this.tech_.one("dispose",u),s!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return r},set(){}},mode:{get(){return s},set(c){ld[c]&&s!==c&&(s=c,!this.preload_&&s!=="disabled"&&this.cues.length===0&&cd(this.src,this),this.stopTracking(),s!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?n:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return a;const c=this.tech_.currentTime(),p=[];for(let y=0,T=this.cues.length;y=c&&p.push(x)}if(o=!1,p.length!==this.activeCues_.length)o=!0;else for(let y=0;y{t=Xt.LOADED,this.trigger({type:"load",target:this})})}}Xt.prototype.allowedEvents_={load:"load"};Xt.NONE=0;Xt.LOADING=1;Xt.LOADED=2;Xt.ERROR=3;const ut={audio:{ListClass:Gf,TrackClass:Yf,capitalName:"Audio"},video:{ListClass:Xf,TrackClass:Qf,capitalName:"Video"},text:{ListClass:Xl,TrackClass:kr,capitalName:"Text"}};Object.keys(ut).forEach(function(i){ut[i].getterName=`${i}Tracks`,ut[i].privateName=`${i}Tracks_`});const bs={remoteText:{ListClass:Xl,TrackClass:kr,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:Tv,TrackClass:Xt,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},He=Object.assign({},ut,bs);bs.names=Object.keys(bs);ut.names=Object.keys(ut);He.names=[].concat(bs.names).concat(ut.names);function Ev(i,e,t,s,r={}){const n=i.textTracks();r.kind=e,t&&(r.label=t),s&&(r.language=s),r.tech=i;const a=new He.text.TrackClass(r);return n.addTrack(a),a}class Y extends B{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=s=>this.onDurationChange(s),this.trackProgress_=s=>this.trackProgress(s),this.trackCurrentTime_=s=>this.trackCurrentTime(s),this.stopTrackingCurrentTime_=s=>this.stopTrackingCurrentTime(s),this.disposeSourceHandler_=s=>this.disposeSourceHandler(s),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),He.names.forEach(s=>{const r=He[s];e&&e[r.getterName]&&(this[r.privateName]=e[r.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(s=>{e[`native${s}Tracks`]===!1&&(this[`featuresNative${s}Tracks`]=!1)}),e.nativeCaptions===!1||e.nativeTextTracks===!1?this.featuresNativeTextTracks=!1:(e.nativeCaptions===!0||e.nativeTextTracks===!0)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new He.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(he(this,function(){const t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,t===1&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return yt(0,0)}bufferedPercent(){return Wf(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(ut.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const s=this[`${t}Tracks`]()||[];let r=s.length;for(;r--;){const n=s[r];t==="text"&&this.removeRemoteTextTrack(n),s.removeTrack(n)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const s=e[t];this.removeRemoteTextTrack(s)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new Te(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?yt(0,0):yt()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){ut.names.forEach(e=>{const t=ut[e],s=()=>{this.trigger(`${e}trackchange`)},r=this[t.getterName]();r.addEventListener("removetrack",s),r.addEventListener("addtrack",s),this.on("dispose",()=>{r.removeEventListener("removetrack",s),r.removeEventListener("addtrack",s)})})}addWebVttScript_(){if(!C.WebVTT)if(j.body.contains(this.el())){if(!this.options_["vtt.js"]&&gs(Dc)&&Object.keys(Dc).length>0){this.trigger("vttjsloaded");return}const e=j.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),C.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),s=o=>e.addTrack(o.track),r=o=>e.removeTrack(o.track);t.on("addtrack",s),t.on("removetrack",r),this.addWebVttScript_();const n=()=>this.trigger("texttrackchange"),a=()=>{n();for(let o=0;othis.autoRemoteTextTracks_.addTrack(s.track)),s}removeRemoteTextTrack(e){const t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=ct();return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return Y.canPlayType(e.type)}static isTech(e){return e.prototype instanceof Y||e instanceof Y||e===Y}static registerTech(e,t){if(Y.techs_||(Y.techs_={}),!Y.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!Y.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!Y.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=be(e),Y.techs_[e]=t,Y.techs_[cr(e)]=t,e!=="Tech"&&Y.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(Y.techs_&&Y.techs_[e])return Y.techs_[e];if(e=be(e),C&&C.videojs&&C.videojs[e])return Z.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),C.videojs[e]}}}He.names.forEach(function(i){const e=He[i];Y.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});Y.prototype.featuresVolumeControl=!0;Y.prototype.featuresMuteControl=!0;Y.prototype.featuresFullscreenResize=!1;Y.prototype.featuresPlaybackRate=!1;Y.prototype.featuresProgressEvents=!1;Y.prototype.featuresSourceset=!1;Y.prototype.featuresTimeupdateEvents=!1;Y.prototype.featuresNativeTextTracks=!1;Y.prototype.featuresVideoFrameCallback=!1;Y.withSourceHandlers=function(i){i.registerSourceHandler=function(t,s){let r=i.sourceHandlers;r||(r=i.sourceHandlers=[]),s===void 0&&(s=r.length),r.splice(s,0,t)},i.canPlayType=function(t){const s=i.sourceHandlers||[];let r;for(let n=0;nSi(e,Ii[e.type],t,i),1)}function Av(i,e){i.forEach(t=>t.setTech&&t.setTech(e))}function Dv(i,e,t){return i.reduceRight(Jl(t),e[t]())}function kv(i,e,t,s){return e[t](i.reduce(Jl(t),s))}function dd(i,e,t,s=null){const r="call"+be(t),n=i.reduce(Jl(r),s),a=n===zn,o=a?null:e[t](n);return Ov(i,t,o,a),o}const Iv={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},Pv={setCurrentTime:1,setMuted:1,setVolume:1},hd={play:1,pause:1};function Jl(i){return(e,t)=>e===zn?zn:t[i]?t[i](e):e}function Ov(i,e,t,s){for(let r=i.length-1;r>=0;r--){const n=i[r];n[e]&&n[e](s,t)}}function Lv(i){Vn.hasOwnProperty(i.id())&&delete Vn[i.id()]}function Rv(i,e){const t=Vn[i.id()];let s=null;if(t==null)return s=e(i),Vn[i.id()]=[[e,s]],s;for(let r=0;r{if(!e)return"";if(i.cache_.source.src===e&&i.cache_.source.type)return i.cache_.source.type;const t=i.cache_.sources.filter(r=>r.src===e);if(t.length)return t[0].type;const s=i.$$("source");for(let r=0;r `;const pd=Un?10009:qn?461:8,Gi={codes:{play:415,pause:19,ff:417,rw:412,back:pd},names:{415:"play",19:"pause",417:"ff",412:"rw",[pd]:"back"},isEventKey(i,e){return e=e.toLowerCase(),!!(this.names[i.keyCode]&&this.names[i.keyCode]===e)},getEventName(i){if(this.names[i.keyCode])return this.names[i.keyCode];if(this.codes[i.code]){const e=this.codes[i.code];return this.names[e]}return null}},md=5;class Fv extends ot{constructor(e){super(),this.player_=e,this.focusableComponents=[],this.isListening_=!1,this.isPaused_=!1,this.onKeyDown_=this.onKeyDown_.bind(this),this.lastFocusedComponent_=null}start(){this.isListening_||(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",()=>{this.focus(this.updateFocusableComponents()[0])}),this.player_.on("modalclose",()=>{this.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0,this.player_.errorDisplay&&this.player_.errorDisplay.on("aftermodalfill",()=>{this.updateFocusableComponents(),this.focusableComponents.length&&(this.focusableComponents.length>1?this.focusableComponents[1].focus():this.focusableComponents[0].focus())}))}stop(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}onKeyDown_(e){const t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();const s=t.key.substring(5).toLowerCase();this.move(s)}else if(Gi.isEventKey(t,"play")||Gi.isEventKey(t,"pause")||Gi.isEventKey(t,"ff")||Gi.isEventKey(t,"rw")){t.preventDefault();const s=Gi.getEventName(t);this.performMediaAction_(s)}else Gi.isEventKey(t,"Back")&&e.target&&typeof e.target.closeable=="function"&&e.target.closeable()&&(t.preventDefault(),e.target.close())}performMediaAction_(e){if(this.player_)switch(e){case"play":this.player_.paused()&&this.player_.play();break;case"pause":this.player_.paused()||this.player_.pause();break;case"ff":this.userSeek_(this.player_.currentTime()+md);break;case"rw":this.userSeek_(this.player_.currentTime()-md);break}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}pause(){this.isPaused_=!0}resume(){this.isPaused_=!1}handlePlayerBlur_(e){const t=e.relatedTarget;let s=null;const r=this.getCurrentComponent(e.target);t&&(s=!!t.closest(".video-js"),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!s||!t)&&(r&&r.name()==="CloseButton"?this.refocusComponent():(this.pause(),r&&r.el()&&(this.lastFocusedComponent_=r)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){const e=this.player_,t=[];function s(r){for(const n of r)n.hasOwnProperty("el_")&&n.getIsFocusable()&&n.getIsAvailableToBeFocused(n.el())&&t.push(n),n.hasOwnProperty("children_")&&n.children_.length>0&&s(n.children_)}return e.children_.forEach(r=>{if(r.hasOwnProperty("el_"))if(r.getIsFocusable&&r.getIsAvailableToBeFocused&&r.getIsFocusable()&&r.getIsAvailableToBeFocused(r.el())){t.push(r);return}else r.hasOwnProperty("children_")&&r.children_.length>0?s(r.children_):r.hasOwnProperty("items")&&r.items.length>0?s(r.items):this.findSuitableDOMChild(r)&&t.push(r);if(r.name_==="ErrorDisplay"&&r.opened_){const n=r.el_.querySelector(".vjs-errors-ok-button-container");n&&n.querySelectorAll("button").forEach((o,u)=>{t.push({name:()=>"ModalButton"+(u+1),el:()=>o,getPositions:()=>{const c=o.getBoundingClientRect(),p={x:c.x,y:c.y,width:c.width,height:c.height,top:c.top,right:c.right,bottom:c.bottom,left:c.left},y={x:c.left+c.width/2,y:c.top+c.height/2,width:0,height:0,top:c.top+c.height/2,right:c.left+c.width/2,bottom:c.top+c.height/2,left:c.left+c.width/2};return{boundingClientRect:p,center:y}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:c=>!0,focus:()=>o.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(s){if(e.getIsFocusable(s)&&e.getIsAvailableToBeFocused(s))return s;for(let r=0;r0&&(this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents}))}move(e){const t=this.getCurrentComponent();if(!t)return;const s=t.getPositions(),r=this.focusableComponents.filter(a=>a!==t&&this.isInDirection_(s.boundingClientRect,a.getPositions().boundingClientRect,e)),n=this.findBestCandidate_(s.center,r,e);n?this.focus(n):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,s){let r=1/0,n=null;for(const a of t){const o=a.getPositions().center,u=this.calculateDistance_(e,o,s);u=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(let e=0;ethis.handleMouseOver(s),this.handleMouseOut_=s=>this.handleMouseOut(s),this.handleClick_=s=>this.handleClick(s),this.handleKeyDown_=s=>this.handleKeyDown(s),this.emitTapEvents(),this.enable()}createEl(e="div",t={},s={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&Z.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),s=Object.assign({role:"button"},s),this.tabIndex_=t.tabIndex;const r=K(e,t,s);return this.player_.options_.experimentalSvgIcons||r.appendChild(K("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=K("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(e===void 0)return this.controlText_||"Need Text";const s=this.localize(e);this.controlText_=e,fi(this.controlTextEl_,s),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",s)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u"&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_<"u"&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){e.key===" "||e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}B.registerComponent("ClickableComponent",Ca);class Ko extends Ca{constructor(e,t){super(e,t),this.update(),this.update_=s=>this.update(s),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return K("div",{className:"vjs-poster"})}crossOrigin(e){if(typeof e>"u")return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.$("img")&&(this.$("img").crossOrigin=e)}update(e){const t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){if(!e){this.el_.textContent="";return}this.$("img")||this.el_.appendChild(K("picture",{className:"vjs-poster",tabIndex:-1},{},K("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?At(this.player_.play()):this.player_.pause())}}Ko.prototype.crossorigin=Ko.prototype.crossOrigin;B.registerComponent("PosterImage",Ko);const lt="#222",gd="#ccc",qv={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function bo(i,e){let t;if(i.length===4)t=i[1]+i[1]+i[2]+i[2]+i[3]+i[3];else if(i.length===7)t=i.slice(1);else throw new Error("Invalid color code provided, "+i+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+","+e+")"}function xt(i,e,t){try{i.style[e]=t}catch{return}}function yd(i){return i?`${i}px`:""}class $v extends B{constructor(e,t,s){super(e,t,s);const r=a=>this.updateDisplay(a),n=a=>{this.updateDisplayOverlay(),this.updateDisplay(a)};e.on("loadstart",a=>this.toggleDisplay(a)),e.on("useractive",r),e.on("userinactive",r),e.on("texttrackchange",r),e.on("loadedmetadata",a=>{this.updateDisplayOverlay(),this.preselectTrack(a)}),e.ready(he(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",n),e.on("playerresize",n);const a=C.screen.orientation||C,o=C.screen.orientation?"change":"orientationchange";a.addEventListener(o,n),e.on("dispose",()=>a.removeEventListener(o,n));const u=this.options_.playerOptions.tracks||[];for(let c=0;c0&&o.forEach(p=>{if(p.style.inset){const y=p.style.inset.split(" ");y.length===3&&Object.assign(p.style,{top:y[0],right:y[1],bottom:y[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!C.CSS.supports("inset-inline: 10px"))return;const e=this.player_.currentWidth(),t=this.player_.currentHeight(),s=e/t,r=this.player_.videoWidth()/this.player_.videoHeight();let n=0,a=0;Math.abs(s-r)>.1&&(s>r?n=Math.round((e-t*r)/2):a=Math.round((t-e/r)/2)),xt(this.el_,"insetInline",yd(n)),xt(this.el_,"insetBlock",yd(a))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),s=e.activeCues;let r=s.length;for(;r--;){const n=s[r];if(!n)continue;const a=n.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&xt(a.firstChild,"color",bo(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&xt(a.firstChild,"backgroundColor",bo(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?xt(a,"backgroundColor",bo(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${lt}, 2px 2px 4px ${lt}, 2px 2px 5px ${lt}`:t.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${lt}, 2px 2px ${lt}, 3px 3px ${lt}`:t.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${gd}, 0 1px ${gd}, -1px -1px ${lt}, 0 -1px ${lt}`:t.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${lt}, 0 0 4px ${lt}, 0 0 4px ${lt}, 0 0 4px ${lt}`)),t.fontPercent&&t.fontPercent!==1){const o=C.parseFloat(a.style.fontSize);a.style.fontSize=o*t.fontPercent+"px",a.style.height="auto",a.style.top="auto"}t.fontFamily&&t.fontFamily!=="default"&&(t.fontFamily==="small-caps"?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=qv[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof C.WebVTT!="function"||e.every(s=>!s.activeCues))return;const t=[];for(let s=0;sthis.handleMouseDown(s))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(e.type==="tap"||this.mouseused_&&"clientX"in e&&"clientY"in e){At(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const s=this.player_.getChild("controlBar"),r=s&&s.getChild("playToggle");if(!r){this.player_.tech(!0).focus();return}const n=()=>r.focus();dr(t)?t.then(n,()=>{}):this.setTimeout(n,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}Zf.prototype.controlText_="Play Video";B.registerComponent("BigPlayButton",Zf);class Hv extends Be{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){e.key==="Escape"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}B.registerComponent("CloseButton",Hv);class ep extends Be{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",s=>this.handlePlay(s)),this.on(e,"pause",s=>this.handlePause(s)),t.replay&&this.on(e,"ended",s=>this.handleEnded(s))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?At(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",t=>this.handleSeeked(t))}}ep.prototype.controlText_="Play";B.registerComponent("PlayToggle",ep);class ws extends B{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],s=>this.update(s)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),s=K("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(s),this.contentEl_=K("span",{className:`${e}-display`},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){!this.player_.options_.enableSmoothSeeking&&e.type==="seeking"||this.updateContent(e)}updateTextNode_(e=0){e=Ni(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let t=this.textNode_;t&&this.contentEl_.firstChild!==t&&(t=null,Z.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=j.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}ws.prototype.labelText_="Time";ws.prototype.controlText_="Time";B.registerComponent("TimeDisplay",ws);class Zl extends ws{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;this.player_.ended()?t=this.player_.duration():e&&e.target&&typeof e.target.pendingSeekTime=="function"?t=e.target.pendingSeekTime():t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}Zl.prototype.labelText_="Current Time";Zl.prototype.controlText_="Current Time";B.registerComponent("CurrentTimeDisplay",Zl);class eu extends ws{constructor(e,t){super(e,t);const s=r=>this.updateContent(r);this.on(e,"durationchange",s),this.on(e,"loadstart",s),this.on(e,"loadedmetadata",s)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}eu.prototype.labelText_="Duration";eu.prototype.controlText_="Duration";B.registerComponent("DurationDisplay",eu);class Vv extends B{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),s=super.createEl("span",{textContent:"/"});return t.appendChild(s),e.appendChild(t),e}}B.registerComponent("TimeDivider",Vv);class tu extends ws{constructor(e,t){super(e,t),this.on(e,"durationchange",s=>this.updateContent(s))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(K("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if(typeof this.player_.duration()!="number")return;let t;this.player_.ended()?t=0:this.player_.remainingTimeDisplay?t=this.player_.remainingTimeDisplay():t=this.player_.remainingTime(),this.updateTextNode_(t)}}tu.prototype.labelText_="Remaining Time";tu.prototype.controlText_="Remaining Time";B.registerComponent("RemainingTimeDisplay",tu);class zv extends B{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",s=>this.updateShowing(s))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=K("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(K("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(j.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}B.registerComponent("LiveDisplay",zv);class tp extends Be{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=s=>this.updateLiveEdgeStatus(s),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=K("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}tp.prototype.controlText_="Seek to live, currently playing live";B.registerComponent("SeekToLive",tp);function Ir(i,e,t){return i=Number(i),Math.min(t,Math.max(e,isNaN(i)?e:i))}var Wv=Object.freeze({__proto__:null,clamp:Ir});class iu extends B{constructor(e,t){super(e,t),this.handleMouseDown_=s=>this.handleMouseDown(s),this.handleMouseUp_=s=>this.handleMouseUp(s),this.handleKeyDown_=s=>this.handleKeyDown(s),this.handleClick_=s=>this.handleClick(s),this.handleMouseMove_=s=>this.handleMouseMove(s),this.update_=s=>this.update(s),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,t={},s={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),s=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},s),super.createEl(e,t,s)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!Nt&&e.preventDefault(),Af(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){const t=this.bar.el_.ownerDocument;Df(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;const e=this.getProgress();return e===this.progress_||(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",()=>{const t=this.vertical()?"height":"width";this.bar.el().style[t]=(e*100).toFixed(2)+"%"})),e}getProgress(){return Number(Ir(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=Ta(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,s=t&&t.enabled,r=t&&t.horizontalSeek;s?r&&e.key==="ArrowLeft"||!r&&e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):r&&e.key==="ArrowRight"||!r&&e.key==="ArrowUp"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(this.pendingSeekTime()&&(this.pendingSeekTime(null),this.userSeek_(this.player_.currentTime())),super.handleKeyDown(e)):e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):e.key==="ArrowUp"||e.key==="ArrowRight"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(e===void 0)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}B.registerComponent("Slider",iu);const vo=(i,e)=>Ir(i/e*100,0,100).toFixed(2)+"%";class Gv extends B{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",s=>this.update(s))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=K("span",{className:"vjs-control-text"}),s=K("span",{textContent:this.localize("Loaded")}),r=j.createTextNode(": ");return this.percentageEl_=K("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(s),t.appendChild(r),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{const t=this.player_.liveTracker,s=this.player_.buffered(),r=t&&t.isLive()?t.seekableEnd():this.player_.duration(),n=this.player_.bufferedEnd(),a=this.partEls_,o=vo(n,r);this.percent_!==o&&(this.el_.style.width=o,fi(this.percentageEl_,o),this.percent_=o);for(let u=0;us.length;u--)this.el_.removeChild(a[u-1]);a.length=s.length})}}B.registerComponent("LoadProgressBar",Gv);class Xv extends B{constructor(e,t){super(e,t),this.update=Mt(he(this,this.update),dt)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,s){const r=Tr(this.el_),n=_s(this.player_.el()),a=e.width*t;if(!n||!r)return;let o=e.left-n.left+a,u=e.width-a+(n.right-e.right);u||(u=e.width-a,o=a);let c=r.width/2;or.width&&(c=r.width),c=Math.round(c),this.el_.style.right=`-${c}px`,this.write(s)}write(e){fi(this.el_,e)}updateTime(e,t,s,r){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let n;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const o=this.player_.liveTracker.liveWindow(),u=o-t*o;n=(u<1?"":"-")+Ni(u,o)}else n=Ni(s,a);this.update(e,t,n),r&&r()})}}B.registerComponent("TimeTooltip",Xv);class su extends B{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=Mt(he(this,this.update),dt)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t,s){const r=this.getChild("timeTooltip");if(!r)return;const n=s&&s.target&&typeof s.target.pendingSeekTime=="function"?s.target.pendingSeekTime():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();r.updateTime(e,t,n)}}su.prototype.options_={children:[]};!Ne&&!Tt&&su.prototype.options_.children.push("timeTooltip");B.registerComponent("PlayProgressBar",su);class ip extends B{constructor(e,t){super(e,t),this.update=Mt(he(this,this.update),dt)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const s=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,s,()=>{this.el_.style.left=`${e.width*t}px`})}}ip.prototype.options_={children:["timeTooltip"]};B.registerComponent("MouseTimeDisplay",ip);class wa extends iu{constructor(e,t){t=ue(wa.prototype.options_,t),t.children=[...t.children];const s=e.options_.disableSeekWhileScrubbingOnMobile&&(Ne||Tt)||e.options_.disableSeekWhileScrubbingOnSTV;(!Ne&&!Tt||s)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbing_=s,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=he(this,this.update),this.update=Mt(this.update_,dt),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in j&&"visibilityState"in j&&this.on(j,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){j.visibilityState==="hidden"?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(!this.player_.ended()&&!this.player_.paused()&&this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,dt))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended"||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if(j.visibilityState==="hidden")return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const s=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),r=this.player_.liveTracker;let n=this.player_.duration();r&&r.isLive()&&(n=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(t*100).toFixed(2)),this.percent_=t),(this.currentTime_!==s||this.duration_!==n)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Ni(s,n),Ni(n,n)],"{1} of {2}")),this.currentTime_=s,this.duration_=n),this.bar&&this.bar.update(_s(this.el()),this.getProgress(),e)}),t}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}pendingSeekTime(e){if(e!==void 0)if(e!==null){const t=this.player_.duration();this.pendingSeekTime_=Math.max(0,Math.min(e,t))}else this.pendingSeekTime_=null;return this.pendingSeekTime_}getPercent(){if(this.pendingSeekTime()!==null)return this.pendingSeekTime()/this.player_.duration();const e=this.getCurrentTime_();let t;const s=this.player_.liveTracker;return s&&s.isLive()?(t=(e-s.seekableStart())/s.liveWindow(),s.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){br(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbing_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!br(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let s;const r=this.calculateDistance(e),n=this.player_.liveTracker;if(!n||!n.isLive())s=r*this.player_.duration(),s===this.player_.duration()&&(s=s-.1);else{if(r>=.99){n.seekToLiveEdge();return}const a=n.seekableStart(),o=n.liveCurrentTime();if(s=a+r*n.liveWindow(),s>=o&&(s=o),s<=a&&(s=a+.1),s===1/0)return}this.shouldDisableSeekWhileScrubbing_?this.pendingSeekTime(s):this.userSeek_(s),this.player_.options_.enableSmoothSeeking&&this.update()}enable(){super.enable();const e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();const e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.pendingSeekTime()!==null&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?At(this.player_.play()):this.update_()}handlePendingSeek_(e){this.player_.paused()||this.player_.pause();const t=this.pendingSeekTime()!==null?this.pendingSeekTime():this.player_.currentTime();this.pendingSeekTime(t+e),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}stepForward(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(this.options().stepSeconds):this.userSeek_(this.player_.currentTime()+this.options().stepSeconds)}stepBack(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(-this.options().stepSeconds):this.userSeek_(this.player_.currentTime()-this.options().stepSeconds)}handleAction(e){this.pendingSeekTime()!==null&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){const t=this.player_.liveTracker;if(e.key===" "||e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(e.key==="Home")e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(e.key==="End")e.preventDefault(),e.stopPropagation(),t&&t.isLive()?this.userSeek_(t.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(e.key)){e.preventDefault(),e.stopPropagation();const s=parseInt(e.key,10)*.1;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*s):this.userSeek_(this.player_.duration()*s)}else e.key==="PageDown"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-this.options().stepSeconds*this.options().pageMultiplier)):e.key==="PageUp"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+this.options().stepSeconds*this.options().pageMultiplier)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["durationchange","timeupdate"],this.update),this.off(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in j&&"visibilityState"in j&&this.off(j,"visibilitychange",this.toggleVisibility_),super.dispose()}}wa.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar",stepSeconds:5,pageMultiplier:12};B.registerComponent("SeekBar",wa);class sp extends B{constructor(e,t){super(e,t),this.handleMouseMove=Mt(he(this,this.handleMouseMove),dt),this.throttledHandleMouseSeek=Mt(he(this,this.handleMouseSeek),dt),this.handleMouseUpHandler_=s=>this.handleMouseUp(s),this.handleMouseDownHandler_=s=>this.handleMouseDown(s),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const s=t.getChild("playProgressBar"),r=t.getChild("mouseTimeDisplay");if(!s&&!r)return;const n=t.el(),a=Tr(n);let o=Ta(n,e).x;o=Ir(o,0,1),r&&r.update(a,o),s&&s.update(a,t.getProgress())}handleMouseSeek(e){const t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach(e=>e.disable&&e.disable()),!!this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&At(this.player_.play())}}enable(){this.children().forEach(e=>e.enable&&e.enable()),!this.enabled()&&(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){const e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){const t=this.el_.ownerDocument,s=this.getChild("seekBar");s&&s.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}sp.prototype.options_={children:["seekBar"]};B.registerComponent("ProgressControl",sp);class rp extends Be{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],s=>this.handlePictureInPictureChange(s)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],s=>this.handlePictureInPictureEnabledChange(s)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){j.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in C?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){typeof j.exitPictureInPicture=="function"&&super.show()}}rp.prototype.controlText_="Picture-in-Picture";B.registerComponent("PictureInPictureToggle",rp);class np extends Be{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",s=>this.handleFullscreenChange(s)),j[e.fsApi_.fullscreenEnabled]===!1&&this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}np.prototype.controlText_="Fullscreen";B.registerComponent("FullscreenToggle",np);const Kv=function(i,e){e.tech_&&!e.tech_.featuresVolumeControl&&i.addClass("vjs-hidden"),i.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")})};class Yv extends B{createEl(){const e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}B.registerComponent("VolumeLevel",Yv);class Qv extends B{constructor(e,t){super(e,t),this.update=Mt(he(this,this.update),dt)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,s,r){if(!s){const n=_s(this.el_),a=_s(this.player_.el()),o=e.width*t;if(!a||!n)return;const u=e.left-a.left+o,c=e.width-o+(a.right-e.right);let p=n.width/2;un.width&&(p=n.width),this.el_.style.right=`-${p}px`}this.write(`${r}%`)}write(e){fi(this.el_,e)}updateVolume(e,t,s,r,n){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,s,r.toFixed(0)),n&&n()})}}B.registerComponent("VolumeLevelTooltip",Qv);class ap extends B{constructor(e,t){super(e,t),this.update=Mt(he(this,this.update),dt)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,s){const r=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,s,r,()=>{s?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}ap.prototype.options_={children:["volumeLevelTooltip"]};B.registerComponent("MouseVolumeLevelDisplay",ap);class Aa extends iu{constructor(e,t){super(e,t),this.on("slideractive",s=>this.updateLastVolume_(s)),this.on(e,"volumechange",s=>this.updateARIAAttributes(s)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){br(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const s=this.el(),r=_s(s),n=this.vertical();let a=Ta(s,e);a=n?a.y:a.x,a=Ir(a,0,1),t.update(r,a,n)}br(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){const t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(this.player_.volume()*100)}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{this.player_.volume()===0&&this.player_.lastVolume_(e)})}}Aa.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!Ne&&!Tt&&Aa.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");Aa.prototype.playerEvent="volumechange";B.registerComponent("VolumeBar",Aa);class op extends B{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||gs(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),Kv(this,e),this.throttledHandleMouseMove=Mt(he(this,this.handleMouseMove),dt),this.handleMouseUpHandler_=s=>this.handleMouseUp(s),this.on("mousedown",s=>this.handleMouseDown(s)),this.on("touchstart",s=>this.handleMouseDown(s)),this.on("mousemove",s=>this.handleMouseMove(s)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}op.prototype.options_={children:["volumeBar"]};B.registerComponent("VolumeControl",op);const Jv=function(i,e){e.tech_&&!e.tech_.featuresMuteControl&&i.addClass("vjs-hidden"),i.on(e,"loadstart",function(){e.tech_.featuresMuteControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")})};class lp extends Be{constructor(e,t){super(e,t),Jv(this,e),this.on(e,["loadstart","volumechange"],s=>this.update(s))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),s=this.player_.lastVolume_();if(t===0){const r=s<.1?.1:s;this.player_.volume(r),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;this.setIcon("volume-high"),Ne&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),ya(this.el_,[0,1,2,3].reduce((s,r)=>s+`${r?" ":""}vjs-vol-${r}`,"")),ki(this.el_,`vjs-vol-${t}`)}updateControlText_(){const t=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)}}lp.prototype.controlText_="Mute";B.registerComponent("MuteToggle",lp);class up extends B{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||gs(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=s=>this.handleKeyPress(s),this.on(e,["loadstart"],s=>this.volumePanelState_(s)),this.on(this.muteToggle,"keyup",s=>this.handleKeyPress(s)),this.on(this.volumeControl,"keyup",s=>this.handleVolumeControlKeyUp(s)),this.on("keydown",s=>this.handleKeyPress(s)),this.on("mouseover",s=>this.handleMouseOver(s)),this.on("mouseout",s=>this.handleMouseOut(s)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){e.key==="Escape"&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),at(j,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),Me(j,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}up.prototype.options_={children:["muteToggle","volumeControl"]};B.registerComponent("VolumePanel",up);class cp extends Be{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;const t=this.player_.currentTime(),s=this.player_.liveTracker,r=s&&s.isLive()?s.seekableEnd():this.player_.duration();let n;t+this.skipTime<=r?n=t+this.skipTime:n=r,this.player_.currentTime(n)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}cp.prototype.controlText_="Skip Forward";B.registerComponent("SkipForward",cp);class dp extends Be{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),s=this.player_.liveTracker,r=s&&s.isLive()&&s.seekableStart();let n;r&&t-this.skipTime<=r?n=r:t>=this.skipTime?n=t-this.skipTime:n=0,this.player_.currentTime(n)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}dp.prototype.controlText_="Skip Backward";B.registerComponent("SkipBackward",dp);class hp extends B{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",s=>this.handleKeyDown(s)),this.boundHandleBlur_=s=>this.handleBlur(s),this.boundHandleTapClick_=s=>this.handleTapClick(s)}addEventListenerForItem(e){e instanceof B&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof B&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){typeof e=="string"&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=K(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),at(t,"click",function(s){s.preventDefault(),s.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||j.activeElement;if(!this.children().some(s=>s.el()===t)){const s=this.menuButton_;s&&s.buttonPressed_&&t!==s.el().firstChild&&s.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const s=t.filter(r=>r.el()===e.target)[0];if(!s)return;s.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}}handleKeyDown(e){e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(e.key==="ArrowRight"||e.key==="ArrowUp")&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){const t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}B.registerComponent("Menu",hp);class ru extends B{constructor(e,t={}){super(e,t),this.menuButton_=new Be(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const s=Be.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+s,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const r=n=>this.handleClick(n);this.handleMenuKeyUp_=n=>this.handleMenuKeyUp(n),this.on(this.menuButton_,"tap",r),this.on(this.menuButton_,"click",r),this.on(this.menuButton_,"keydown",n=>this.handleKeyDown(n)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),at(j,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",n=>this.handleMouseLeave(n)),this.on("keydown",n=>this.handleSubmenuKeyDown(n))}update(){const e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){const e=new hp(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=K("li",{className:"vjs-menu-title",textContent:be(this.options_.title),tabIndex:-1}),s=new B(this.player_,{el:t});e.addItem(s)}if(this.items=this.createItems(),this.items)for(let t=0;t{this.handleTracksChange.apply(this,o)},a=(...o)=>{this.handleSelectedLanguageChange.apply(this,o)};if(e.on(["loadstart","texttrackchange"],n),r.addEventListener("change",n),r.addEventListener("selectedlanguagechange",a),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],n),r.removeEventListener("change",n),r.removeEventListener("selectedlanguagechange",a)}),r.onchange===void 0){let o;this.on(["tap","click"],function(){if(typeof C.Event!="object")try{o=new C.Event("change")}catch{}o||(o=j.createEvent("Event"),o.initEvent("change",!0,!0)),r.dispatchEvent(o)})}this.handleTracksChange()}handleClick(e){const t=this.track,s=this.player_.textTracks();if(super.handleClick(e),!!s)for(let r=0;r-1&&a.mode==="showing"){s=!1;break}}s!==this.isSelected_&&this.selected(s)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let s=!0;for(let r=0,n=t.length;r-1&&a.mode==="showing"){s=!1;break}}s&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}B.registerComponent("OffTextTrackMenuItem",fp);class As extends nu{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Or){let s;this.label_&&(s=`${this.label_} off`),e.push(new fp(this.player_,{kinds:this.kinds_,kind:this.kind_,label:s})),this.hideThreshold_+=1;const r=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let n=0;n-1){const o=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});o.addClass(`vjs-${a.kind}-menu-item`),e.push(o)}}return e}}B.registerComponent("TextTrackButton",As);class pp extends Pr{constructor(e,t){const s=t.track,r=t.cue,n=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=r.text,t.selected=r.startTime<=n&&n{this.items.forEach(r=>{r.selected(this.track_.activeCues[0]===r.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&e.track.kind!=="chapters")return;const t=this.findChaptersTrack();t!==this.track_?(this.setTrack(t),super.update()):(!this.items||t&&t.cues&&t.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const e=this.player_.textTracks()||[];for(let t=e.length-1;t>=0;t--){const s=e[t];if(s.kind===this.kind_)return s}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(be(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let s=0,r=t.length;s-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(be(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new uu(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,mp),e}}du.prototype.kinds_=["captions","subtitles"];du.prototype.controlText_="Subtitles";B.registerComponent("SubsCapsButton",du);class gp extends Pr{constructor(e,t){const s=t.track,r=e.audioTracks();t.label=s.label||s.language||"Unknown",t.selected=s.enabled,super(e,t),this.track=s,this.addClass(`vjs-${s.kind}-menu-item`);const n=(...a)=>{this.handleTracksChange.apply(this,a)};r.addEventListener("change",n),this.on("dispose",()=>{r.removeEventListener("change",n)})}createEl(e,t,s){const r=super.createEl(e,t,s),n=r.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(n.appendChild(K("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(K("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),r}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const t=this.player_.audioTracks();for(let s=0;sthis.update(n))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}hu.prototype.contentElType="button";B.registerComponent("PlaybackRateMenuItem",hu);class _p extends ru{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",s=>this.updateVisibility(s)),this.on(e,"ratechange",s=>this.updateLabel(s)),this.on(e,"playbackrateschange",s=>this.handlePlaybackRateschange(s))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=K("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let s=e.length-1;s>=0;s--)t.push(new hu(this.player(),{rate:e[s]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){const e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}_p.prototype.controlText_="Playback Rate";B.registerComponent("PlaybackRateMenuButton",_p);class Tp extends B{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},s={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,s)}}B.registerComponent("Spacer",Tp);class Zv extends Tp{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}B.registerComponent("CustomControlSpacer",Zv);class bp extends B{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}bp.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};B.registerComponent("ControlBar",bp);class vp extends Cs{constructor(e,t){super(e,t),this.on(e,"error",s=>{this.open(s)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}vp.prototype.options_=Object.assign({},Cs.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});B.registerComponent("ErrorDisplay",vp);class Sp extends B{constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),K("select",{id:this.options_.id},{},this.options_.SelectOptions.map(t=>{const s=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${ct()}`)+"-"+t[1].replace(/\W+/g,""),r=K("option",{id:s,value:this.localize(t[0]),textContent:this.localize(t[1])});return r.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${s}`),r}))}}B.registerComponent("TextTrackSelect",Sp);class Pi extends B{constructor(e,t={}){super(e,t);const s=K("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(s);const r=this.options_.selects;for(const n of r){const a=this.options_.selectConfigs[n],o=a.className,u=a.id.replace("%s",this.options_.id_);let c=null;const p=`vjs_select_${ct()}`;if(this.options_.type==="colors"){c=K("span",{className:o});const T=K("label",{id:u,className:"vjs-label",textContent:this.localize(a.label)});T.setAttribute("for",p),c.appendChild(T)}const y=new Sp(e,{SelectOptions:a.options,legendId:this.options_.legendId,id:p,labelId:u});this.addChild(y),this.options_.type==="colors"&&(c.appendChild(y.el()),this.el().appendChild(c))}}createEl(){return K("fieldset",{className:this.options_.className})}}B.registerComponent("TextTrackFieldset",Pi);class xp extends B{constructor(e,t={}){super(e,t);const s=this.options_.textTrackComponentid,r=new Pi(e,{id_:s,legendId:`captions-text-legend-${s}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(r);const n=new Pi(e,{id_:s,legendId:`captions-background-${s}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(n);const a=new Pi(e,{id_:s,legendId:`captions-window-${s}`,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(a)}createEl(){return K("div",{className:"vjs-track-settings-colors"})}}B.registerComponent("TextTrackSettingsColors",xp);class Ep extends B{constructor(e,t={}){super(e,t);const s=this.options_.textTrackComponentid,r=new Pi(e,{id_:s,legendId:`captions-font-size-${s}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(r);const n=new Pi(e,{id_:s,legendId:`captions-edge-style-${s}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(n);const a=new Pi(e,{id_:s,legendId:`captions-font-family-${s}`,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(a)}createEl(){return K("div",{className:"vjs-track-settings-font"})}}B.registerComponent("TextTrackSettingsFont",Ep);class Cp extends B{constructor(e,t={}){super(e,t);const s=new Be(e,{controlText:this.localize("restore all settings to the default values"),className:"vjs-default-button"});s.el().classList.remove("vjs-control","vjs-button"),s.el().textContent=this.localize("Reset"),this.addChild(s);const r=this.localize("Done"),n=new Be(e,{controlText:r,className:"vjs-done-button"});n.el().classList.remove("vjs-control","vjs-button"),n.el().textContent=r,this.addChild(n)}createEl(){return K("div",{className:"vjs-track-settings-controls"})}}B.registerComponent("TrackSettingsControls",Cp);const So="vjs-text-track-settings",_d=["#000","Black"],Td=["#00F","Blue"],bd=["#0FF","Cyan"],vd=["#0F0","Green"],Sd=["#F0F","Magenta"],xd=["#F00","Red"],Ed=["#FFF","White"],Cd=["#FF0","Yellow"],xo=["1","Opaque"],Eo=["0.5","Semi-Transparent"],wd=["0","Transparent"],ai={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[_d,Ed,xd,vd,Td,Cd,Sd,bd],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[xo,Eo,wd],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Ed,_d,xd,vd,Td,Cd,Sd,bd],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:i=>i==="1.00"?null:Number(i)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[xo,Eo],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[wd,Eo,xo],className:"vjs-window-opacity vjs-opacity"}};ai.windowColor.options=ai.backgroundColor.options;function wp(i,e){if(e&&(i=e(i)),i&&i!=="none")return i}function e2(i,e){const t=i.options[i.options.selectedIndex].value;return wp(t,e)}function t2(i,e,t){if(e){for(let s=0;s{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],()=>{this.setDefaults(),this.updateDisplay()}),Zi(ai,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)})}dispose(){this.endDialog=null,super.dispose()}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return mf(ai,(e,t,s)=>{const r=e2(this.$(t.selector),t.parser);return r!==void 0&&(e[s]=r),e},{})}setValues(e){Zi(ai,(t,s)=>{t2(this.$(t.selector),e[s],t.parser)})}setDefaults(){Zi(ai,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(C.localStorage.getItem(So))}catch(t){Z.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?C.localStorage.setItem(So,JSON.stringify(e)):C.localStorage.removeItem(So)}catch(t){Z.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}B.registerComponent("TextTrackSettings",i2);class s2 extends B{constructor(e,t){let s=t.ResizeObserver||C.ResizeObserver;t.ResizeObserver===null&&(s=!1);const r=ue({createEl:!s,reportTouchActivity:!1},t);super(e,r),this.ResizeObserver=t.ResizeObserver||C.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=Ff(()=>{this.resizeHandler()},100,!1,this),s?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const n=this.debouncedHandler_;let a=this.unloadListener_=function(){Me(this,"resize",n),Me(this,"unload",a),a=null};at(this.el_.contentWindow,"unload",a),at(this.el_.contentWindow,"resize",n)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){!this.player_||!this.player_.trigger||this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}B.registerComponent("ResizeManager",s2);const r2={trackingThreshold:20,liveTolerance:15};class n2 extends B{constructor(e,t){const s=ue(r2,t,{createEl:!1});super(e,s),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=r=>this.handlePlay(r),this.handleFirstTimeupdate_=r=>this.handleFirstTimeupdate(r),this.handleSeeked_=r=>this.handleSeeked(r),this.seekToLiveEdge_=r=>this.seekToLiveEdge(r),this.reset_(),this.on(this.player_,"durationchange",r=>this.handleDurationchange(r)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(C.performance.now().toFixed(4)),s=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+s;const r=this.liveCurrentTime(),n=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(r-n)>this.options_.liveTolerance;(!this.timeupdateSeen_||r===1/0)&&(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,dt),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),t=[];let s=e?e.length:0;for(;s--;)t.push(e.end(s));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let s=e?e.length:0;for(;s--;)t.push(e.start(s));return t.length?t.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_=="number"}seekToLiveEdge(){this.seekedBehindLive_=!1,!this.atLiveEdge()&&(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}B.registerComponent("LiveTracker",n2);class a2 extends B{constructor(e,t){super(e,t),this.on("statechanged",s=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:K("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${ct()}`}),description:K("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${ct()}`})},K("div",{className:"vjs-title-bar"},{},gf(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,s={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(r=>{const n=this.state[r],a=this.els[r],o=s[r];ba(a),n&&fi(a,n),t&&(t.removeAttribute(o),n&&t.setAttribute(o,a.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}B.registerComponent("TitleBar",a2);const o2={initialDisplay:4e3,position:[],takeFocus:!1};class l2 extends Be{constructor(e,t){t=ue(o2,t),super(e,t),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],s=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){const e=K("button",{},{type:"button",class:this.buildCSSClass()},K("span"));return this.controlTextEl_=e.querySelector("span"),e}show(){super.show(),this.addClass("force-display"),this.options_.takeFocus&&this.el().focus({preventScroll:!0}),this.forceDisplayTimeout=this.player_.setTimeout(()=>{this.removeClass("force-display")},this.options_.initialDisplay)}hide(){this.removeClass("force-display"),super.hide()}dispose(){this.player_.clearTimeout(this.forceDisplayTimeout),super.dispose()}}B.registerComponent("TransientButton",l2);const Yo=i=>{const e=i.el();if(e.hasAttribute("src"))return i.triggerSourceset(e.src),!0;const t=i.$$("source"),s=[];let r="";if(!t.length)return!1;for(let n=0;n{let t={};for(let s=0;sAp([i.el(),C.HTMLMediaElement.prototype,C.Element.prototype,u2],"innerHTML"),Ad=function(i){const e=i.el();if(e.resetSourceWatch_)return;const t={},s=c2(i),r=n=>(...a)=>{const o=n.apply(e,a);return Yo(i),o};["append","appendChild","insertAdjacentHTML"].forEach(n=>{e[n]&&(t[n]=e[n],e[n]=r(t[n]))}),Object.defineProperty(e,"innerHTML",ue(s,{set:r(s.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(n=>{e[n]=t[n]}),Object.defineProperty(e,"innerHTML",s)},i.one("sourceset",e.resetSourceWatch_)},d2=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?Kf(C.Element.prototype.getAttribute.call(this,"src")):""},set(i){return C.Element.prototype.setAttribute.call(this,"src",i),i}}),h2=i=>Ap([i.el(),C.HTMLMediaElement.prototype,d2],"src"),f2=function(i){if(!i.featuresSourceset)return;const e=i.el();if(e.resetSourceset_)return;const t=h2(i),s=e.setAttribute,r=e.load;Object.defineProperty(e,"src",ue(t,{set:n=>{const a=t.set.call(e,n);return i.triggerSourceset(e.src),a}})),e.setAttribute=(n,a)=>{const o=s.call(e,n,a);return/src/i.test(n)&&i.triggerSourceset(e.src),o},e.load=()=>{const n=r.call(e);return Yo(i)||(i.triggerSourceset(""),Ad(i)),n},e.currentSrc?i.triggerSourceset(e.currentSrc):Yo(i)||Ad(i),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=r,e.setAttribute=s,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class V extends Y{constructor(e,t){super(e,t);const s=e.source;let r=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",s&&(this.el_.currentSrc!==s.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(s):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const n=this.el_.childNodes;let a=n.length;const o=[];for(;a--;){const u=n[a];u.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(u),this.remoteTextTracks().addTrack(u.track),this.textTracks().addTrack(u.track),!r&&!this.el_.hasAttribute("crossorigin")&&Ea(u.src)&&(r=!0)):o.push(u))}for(let u=0;u{t=[];for(let n=0;ne.removeEventListener("change",s));const r=()=>{for(let n=0;n{e.removeEventListener("change",s),e.removeEventListener("change",r),e.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",s),e.addEventListener("change",s),e.removeEventListener("change",r)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const s=e.toLowerCase();this[`${s}TracksListeners_`]&&Object.keys(this[`${s}TracksListeners_`]).forEach(r=>{this.el()[`${s}Tracks`].removeEventListener(r,this[`${s}TracksListeners_`][r])}),this[`featuresNative${e}Tracks`]=!t,this[`${s}TracksListeners_`]=null,this.proxyNativeTracksForType_(s)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=ut[e],s=this.el()[t.getterName],r=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!s||!s.addEventListener)return;const n={change:o=>{const u={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(u),e==="text"&&this[bs.remoteText.getterName]().trigger(u)},addtrack(o){r.addTrack(o.track)},removetrack(o){r.removeTrack(o.track)}},a=function(){const o=[];for(let u=0;u{const u=n[o];s.addEventListener(o,u),this.on("dispose",c=>s.removeEventListener(o,u))}),this.on("loadstart",a),this.on("dispose",o=>this.off("loadstart",a))}proxyNativeTracks_(){ut.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const s=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(s,e),V.disposeMediaElement(e),e=s}else{e=j.createElement("video");const s=this.options_.tag&&ni(this.options_.tag),r=ue({},s);(!_r||this.options_.nativeControlsForTouch!==!0)&&delete r.controls,Cf(e,Object.assign(r,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&ys(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let s=0;s=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready(function(){t.forEach(function(s){this.trigger(s)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&ga?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){Z(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&Tt&&Nt&&this.el_.currentTime===0){const e=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture"&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",t),this.on("dispose",()=>{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}supportsFullScreen(){return typeof this.el_.webkitEnterFullScreen=="function"}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)At(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}},0);else try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(e===void 0)return this.el_.src;this.setSrc(e)}addSourceElement(e,t){if(!e)return Z.error("Invalid source URL."),!1;const s={src:e};t&&(s.type=t);const r=K("source",{},s);return this.el_.appendChild(r),!0}removeSourceElement(e){if(!e)return Z.error("Source URL is required to remove the source element."),!1;const t=this.el_.querySelectorAll("source");for(const s of t)if(s.src===e)return this.el_.removeChild(s),!0;return Z.warn(`No matching source element found with src: ${e}`),!1}reset(){V.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,s){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,s):super.addTextTrack(e,t,s)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=j.createElement("track");return e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t}addRemoteTextTrack(e,t){const s=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(s),s}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let s=t.length;for(;s--;)(e===t[s]||e===t[s].track)&&this.el().removeChild(t[s])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();const e={};return typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u"&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),C.performance&&(e.creationTime=C.performance.now()),e}}ha(V,"TEST_VID",function(){if(!Ss())return;const i=j.createElement("video"),e=j.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",i.appendChild(e),i});V.isSupported=function(){try{V.TEST_VID.volume=.5}catch{return!1}return!!(V.TEST_VID&&V.TEST_VID.canPlayType)};V.canPlayType=function(i){return V.TEST_VID.canPlayType(i)};V.canPlaySource=function(i,e){return V.canPlayType(i.type)};V.canControlVolume=function(){try{const i=V.TEST_VID.volume;V.TEST_VID.volume=i/2+.1;const e=i!==V.TEST_VID.volume;return e&&Ne?(C.setTimeout(()=>{V&&V.prototype&&(V.prototype.featuresVolumeControl=i!==V.TEST_VID.volume)}),!1):e}catch{return!1}};V.canMuteVolume=function(){try{const i=V.TEST_VID.muted;return V.TEST_VID.muted=!i,V.TEST_VID.muted?ys(V.TEST_VID,"muted","muted"):_a(V.TEST_VID,"muted","muted"),i!==V.TEST_VID.muted}catch{return!1}};V.canControlPlaybackRate=function(){if(Tt&&Nt&&fa<58)return!1;try{const i=V.TEST_VID.playbackRate;return V.TEST_VID.playbackRate=i/2+.1,i!==V.TEST_VID.playbackRate}catch{return!1}};V.canOverrideAttributes=function(){try{const i=()=>{};Object.defineProperty(j.createElement("video"),"src",{get:i,set:i}),Object.defineProperty(j.createElement("audio"),"src",{get:i,set:i}),Object.defineProperty(j.createElement("video"),"innerHTML",{get:i,set:i}),Object.defineProperty(j.createElement("audio"),"innerHTML",{get:i,set:i})}catch{return!1}return!0};V.supportsNativeTextTracks=function(){return ga||Ne&&Nt};V.supportsNativeVideoTracks=function(){return!!(V.TEST_VID&&V.TEST_VID.videoTracks)};V.supportsNativeAudioTracks=function(){return!!(V.TEST_VID&&V.TEST_VID.audioTracks)};V.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([i,e]){ha(V.prototype,i,()=>V[e](),!0)});V.prototype.featuresVolumeControl=V.canControlVolume();V.prototype.movingMediaElementInDOM=!Ne;V.prototype.featuresFullscreenResize=!0;V.prototype.featuresProgressEvents=!0;V.prototype.featuresTimeupdateEvents=!0;V.prototype.featuresVideoFrameCallback=!!(V.TEST_VID&&V.TEST_VID.requestVideoFrameCallback);V.disposeMediaElement=function(i){if(i){for(i.parentNode&&i.parentNode.removeChild(i);i.hasChildNodes();)i.removeChild(i.firstChild);i.removeAttribute("src"),typeof i.load=="function"&&function(){try{i.load()}catch{}}()}};V.resetMediaElement=function(i){if(!i)return;const e=i.querySelectorAll("source");let t=e.length;for(;t--;)i.removeChild(e[t]);i.removeAttribute("src"),typeof i.load=="function"&&function(){try{i.load()}catch{}}()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(i){V.prototype[i]=function(){return this.el_[i]||this.el_.hasAttribute(i)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(i){V.prototype["set"+be(i)]=function(e){this.el_[i]=e,e?this.el_.setAttribute(i,i):this.el_.removeAttribute(i)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(i){V.prototype[i]=function(){return this.el_[i]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(i){V.prototype["set"+be(i)]=function(e){this.el_[i]=e}});["pause","load","play"].forEach(function(i){V.prototype[i]=function(){return this.el_[i]()}});Y.withSourceHandlers(V);V.nativeSourceHandler={};V.nativeSourceHandler.canPlayType=function(i){try{return V.TEST_VID.canPlayType(i)}catch{return""}};V.nativeSourceHandler.canHandleSource=function(i,e){if(i.type)return V.nativeSourceHandler.canPlayType(i.type);if(i.src){const t=Ql(i.src);return V.nativeSourceHandler.canPlayType(`video/${t}`)}return""};V.nativeSourceHandler.handleSource=function(i,e,t){e.setSrc(i.src)};V.nativeSourceHandler.dispose=function(){};V.registerSourceHandler(V.nativeSourceHandler);Y.registerTech("Html5",V);const Dp=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Co={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Qo=["tiny","xsmall","small","medium","large","xlarge","huge"],xn={};Qo.forEach(i=>{const e=i.charAt(0)==="x"?`x-${i.substring(1)}`:i;xn[i]=`vjs-layout-${e}`});const p2={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class se extends B{constructor(e,t,s){if(e.id=e.id||t.id||`vjs_video_${ct()}`,t=Object.assign(se.getTagSettings(e),t),t.initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const a=e.closest("[lang]");a&&(t.language=a.getAttribute("lang"))}if(super(null,t,s),this.boundDocumentFullscreenChange_=a=>this.documentFullscreenChange_(a),this.boundFullWindowOnEscKey_=a=>this.fullWindowOnEscKey(a),this.boundUpdateStyleEl_=a=>this.updateStyleEl_(a),this.boundApplyInitTime_=a=>this.applyInitTime_(a),this.boundUpdateCurrentBreakpoint_=a=>this.updateCurrentBreakpoint_(a),this.boundHandleTechClick_=a=>this.handleTechClick_(a),this.boundHandleTechDoubleClick_=a=>this.handleTechDoubleClick_(a),this.boundHandleTechTouchStart_=a=>this.handleTechTouchStart_(a),this.boundHandleTechTouchMove_=a=>this.handleTechTouchMove_(a),this.boundHandleTechTouchEnd_=a=>this.handleTechTouchEnd_(a),this.boundHandleTechTap_=a=>this.handleTechTap_(a),this.boundUpdatePlayerHeightOnAudioOnlyMode_=a=>this.updatePlayerHeightOnAudioOnlyMode_(a),this.isFullscreen_=!1,this.log=ff(this.id_),this.fsApi_=Mn,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={controlBarHeight:null,playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&ni(e),this.language(this.options_.language),t.languages){const a={};Object.getOwnPropertyNames(t.languages).forEach(function(o){a[o.toLowerCase()]=t.languages[o]}),this.languages_=a}else this.languages_=se.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(a=>{if(typeof this[a]!="function")throw new Error(`plugin "${a}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),Wl(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(at(j,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const r=ue(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(a=>{this[a](t.plugins[a])}),t.debug&&this.debug(!0),this.options_.playerOptions=r,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const o=new C.DOMParser().parseFromString(Bv,"image/svg+xml");if(o.querySelector("parsererror"))Z.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const c=o.documentElement;c.style.display="none",this.el_.appendChild(c),this.addClass("vjs-svg-icons-enabled")}}this.initChildren(),this.isAudio(e.nodeName.toLowerCase()==="audio"),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),t.spatialNavigation&&t.spatialNavigation.enabled&&(this.spatialNavigation=new Fv(this),this.addClass("vjs-spatial-navigation-enabled")),_r&&this.addClass("vjs-touch-enabled"),Ne||this.addClass("vjs-workinghover"),se.players[this.id_]=this;const n=qo.split(".")[0];this.addClass(`vjs-v${n}`),this.userActive(!0),this.reportUserActivity(),this.one("play",a=>this.listenForUserActivity_(a)),this.on("keydown",a=>this.handleKeyDown(a)),this.on("languagechange",a=>this.handleLanguagechange(a)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){this.trigger("dispose"),this.off("dispose"),Me(j,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),Me(j,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),se.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),Lv(this),He.names.forEach(e=>{const t=He[e],s=this[t.getterName]();s&&s.off&&s.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,s=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const r=this.tag.tagName.toLowerCase()==="video-js";s?t=this.el_=e.parentNode:r||(t=this.el_=super.createEl("div"));const n=ni(e);if(r){for(t=this.el_=e,e=this.tag=j.createElement("video");t.children.length;)e.appendChild(t.firstChild);ur(t,"video-js")||ki(t,"video-js"),t.appendChild(e),s=this.playerElIngest_=t,Object.keys(t).forEach(u=>{try{e[u]=t[u]}catch{}})}e.setAttribute("tabindex","-1"),n.tabindex="-1",Nt&&pa&&(e.setAttribute("role","application"),n.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in n&&delete n.width,"height"in n&&delete n.height,Object.getOwnPropertyNames(n).forEach(function(u){r&&u==="class"||t.setAttribute(u,n[u]),r&&e.setAttribute(u,n[u])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=t.player=this,this.addClass("vjs-paused");const a=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(u=>vf[u]).map(u=>"vjs-device-"+u.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),C.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=Mf("vjs-styles-dimensions");const u=di(".vjs-styles-defaults"),c=di("head");c.insertBefore(this.styleEl_,u?u.nextSibling:c.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);const o=e.getElementsByTagName("a");for(let u=0;u"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){Z.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){const s=e+"_";if(t===void 0)return this[s]||0;if(t===""||t==="auto"){this[s]=void 0,this.updateStyleEl_();return}const r=parseFloat(t);if(isNaN(r)){Z.error(`Improper value "${t}" supplied for for ${e}`);return}this[s]=r,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,Vt(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),dv(this,()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)})):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(e===void 0)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(e===void 0)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(C.VIDEOJS_NO_DYNAMIC_STYLE===!0){const o=typeof this.width_=="number"?this.width_:this.options_.width,u=typeof this.height_=="number"?this.height_:this.options_.height,c=this.tech_&&this.tech_.el();c&&(o>=0&&(c.width=o),u>=0&&(c.height=u));return}let e,t,s,r;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?s=this.aspectRatio_:this.videoWidth()>0?s=this.videoWidth()+":"+this.videoHeight():s="16:9";const n=s.split(":"),a=n[1]/n[0];this.width_!==void 0?e=this.width_:this.height_!==void 0?e=this.height_/a:e=this.videoWidth()||300,this.height_!==void 0?t=this.height_:t=e*a,/^[^a-zA-Z]/.test(this.id())?r="dimensions-"+this.id():r=this.id()+"-dimensions",this.addClass(r),Bf(this.styleEl_,` .${r} { width: ${e}px; height: ${t}px; } .${r}.vjs-fluid:not(.vjs-audio-only-mode) { padding-top: ${a*100}%; } `)}loadTech_(e,t){this.tech_&&this.unloadTech_();const s=be(e),r=e.charAt(0).toLowerCase()+e.slice(1);s!=="Html5"&&this.tag&&(Y.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=s,this.isReady_=!1;let n=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(n=!1);const a={source:t,autoplay:n,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${r}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};He.names.forEach(u=>{const c=He[u];a[c.getterName]=this[c.privateName]}),Object.assign(a,this.options_[s]),Object.assign(a,this.options_[r]),Object.assign(a,this.options_[e.toLowerCase()]),this.tag&&(a.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(a.startTime=this.cache_.currentTime);const o=Y.getTech(e);if(!o)throw new Error(`No Tech named '${s}' exists! '${s}' should be registered using videojs.registerTech()'`);this.tech_=new o(a),this.tech_.ready(he(this,this.handleTechReady_),!0),Xo.jsonToTextTracks(this.textTracksJson_||[],this.tech_),Dp.forEach(u=>{this.on(this.tech_,u,c=>this[`handleTech${be(u)}_`](c))}),Object.keys(Co).forEach(u=>{this.on(this.tech_,u,c=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${Co[u]}_`].bind(this),event:c});return}this[`handleTech${Co[u]}_`](c)})}),this.on(this.tech_,"loadstart",u=>this.handleTechLoadStart_(u)),this.on(this.tech_,"sourceset",u=>this.handleTechSourceset_(u)),this.on(this.tech_,"waiting",u=>this.handleTechWaiting_(u)),this.on(this.tech_,"ended",u=>this.handleTechEnded_(u)),this.on(this.tech_,"seeking",u=>this.handleTechSeeking_(u)),this.on(this.tech_,"play",u=>this.handleTechPlay_(u)),this.on(this.tech_,"pause",u=>this.handleTechPause_(u)),this.on(this.tech_,"durationchange",u=>this.handleTechDurationChange_(u)),this.on(this.tech_,"fullscreenchange",(u,c)=>this.handleTechFullscreenChange_(u,c)),this.on(this.tech_,"fullscreenerror",(u,c)=>this.handleTechFullscreenError_(u,c)),this.on(this.tech_,"enterpictureinpicture",u=>this.handleTechEnterPictureInPicture_(u)),this.on(this.tech_,"leavepictureinpicture",u=>this.handleTechLeavePictureInPicture_(u)),this.on(this.tech_,"error",u=>this.handleTechError_(u)),this.on(this.tech_,"posterchange",u=>this.handleTechPosterChange_(u)),this.on(this.tech_,"textdata",u=>this.handleTechTextData_(u)),this.on(this.tech_,"ratechange",u=>this.handleTechRateChange_(u)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(s!=="Html5"||!this.tag)&&jo(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){He.names.forEach(e=>{const t=He[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=Xo.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return e===void 0&&Z.warn(`Using the tech directly can be dangerous. I hope you know what you're doing. See https://github.com/videojs/video.js/issues/2617 for more info. `),this.tech_}version(){return{"video.js":qo}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!="string")return;const t=()=>{const r=this.muted();this.muted(!0);const n=()=>{this.muted(r)};this.playTerminatedQueue_.push(n);const a=this.play();if(dr(a))return a.catch(o=>{throw n(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${o||""}`)})};let s;if(e==="any"&&!this.muted()?(s=this.play(),dr(s)&&(s=s.catch(t))):e==="muted"&&!this.muted()?s=t():s=this.play(),!!dr(s))return s.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,s="";typeof t!="string"&&(t=e.src,s=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!s&&(s=Mv(this,t)),this.cache_.source=ue({},e,{src:t,type:s});const r=this.cache_.sources.filter(u=>u.src&&u.src===t),n=[],a=this.$$("source"),o=[];for(let u=0;uthis.updateSourceCaches_(n);const s=this.currentSource().src,r=e.src;s&&!/^blob:/.test(s)&&/^blob:/.test(r)&&(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==s)&&(t=()=>{}),t(r),e.src||this.tech_.any(["sourceset","loadstart"],n=>{if(n.type==="sourceset")return;const a=this.techGet_("currentSrc");this.lastSource_.tech=a,this.updateSourceCaches_(a)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,e):this.paused()?At(this.play()):this.pause())}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),s=>s.contains(e.target))||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,e):this.isInPictureInPicture()&&!j.pictureInPictureElement?this.exitPictureInPicture():this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const t=e.target.player;if(t&&t!==this)return;const s=this.el();let r=j[this.fsApi_.fullscreenElement]===s;!r&&s.matches&&(r=s.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(r)}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){const e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,t){this.ready(function(){if(e in Pv)return kv(this.middleware_,this.tech_,e,t);if(e in hd)return dd(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(s){throw Z(s),s}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in Iv)return Dv(this.middleware_,this.tech_,e);if(e in hd)return dd(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(Z(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(Z(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(Z(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=At){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),s=!!(ga||Ne);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=a=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&s&&this.load();return}const r=this.techGet_("play");s&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),r===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(r)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(t){t()})}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(s){s(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||yt(0,0)}scrubbing(e){if(typeof e>"u")return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;e=parseFloat(e),e<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return(!e||!e.length)&&(e=yt(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=yt(0,0)),e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return Wf(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let s=e.end(e.length-1);return s>t&&(s=t),s}volume(e){let t;if(e!==void 0){t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),t>0&&this.lastVolume_(t);return}return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return e!==void 0&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){const t=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise((s,r)=>{function n(){t.off("fullscreenerror",o),t.off("fullscreenchange",a)}function a(){n(),s()}function o(c,p){n(),r(p)}t.one("fullscreenchange",a),t.one("fullscreenerror",o);const u=t.requestFullscreenHelper_(e);u&&(u.then(n,n),u.then(s,r))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(t=e)),this.fsApi_.requestFullscreen){const s=this.el_[this.fsApi_.requestFullscreen](t);return s&&s.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),s}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,s)=>{function r(){e.off("fullscreenerror",a),e.off("fullscreenchange",n)}function n(){r(),t()}function a(u,c){r(),s(c)}e.one("fullscreenchange",n),e.one("fullscreenerror",a);const o=e.exitFullscreenHelper_();o&&(o.then(r,r),o.then(t,s))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=j[this.fsApi_.exitFullscreen]();return e&&At(e.then(()=>this.isFullscreen(!1))),e}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=j.documentElement.style.overflow,at(j,"keydown",this.boundFullWindowOnEscKey_),j.documentElement.style.overflow="hidden",ki(j.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){e.key==="Escape"&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,Me(j,"keydown",this.boundFullWindowOnEscKey_),j.documentElement.style.overflow=this.docOrigOverflow,ya(j.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(e===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(e!==void 0){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&C.documentPictureInPicture){const e=j.createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(K("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),C.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(Lf(t),this.el_.parentNode.insertBefore(e,this.el_),t.document.body.appendChild(this.el_),t.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:t}),t.addEventListener("pagehide",s=>{const r=s.target.querySelector(".video-js");e.parentNode.replaceChild(r,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in j&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(C.documentPictureInPicture&&C.documentPictureInPicture.window)return C.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in j)return j.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(r=>{const n=r.tagName.toLowerCase();if(r.isContentEditable)return!0;const a=["button","checkbox","hidden","radio","reset","submit"];return n==="input"?a.indexOf(r.type)===-1:["textarea"].indexOf(n)!==-1})(this.el_.ownerDocument.activeElement)||(typeof t.hotkeys=="function"?t.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const t=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:s=a=>e.key.toLowerCase()==="f",muteKey:r=a=>e.key.toLowerCase()==="m",playPauseKey:n=a=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(s.call(this,e)){e.preventDefault(),e.stopPropagation();const a=B.getComponent("FullscreenToggle");j[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else r.call(this,e)?(e.preventDefault(),e.stopPropagation(),B.getComponent("MuteToggle").prototype.handleClick.call(this,e)):n.call(this,e)&&(e.preventDefault(),e.stopPropagation(),B.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let s=0,r=this.options_.techOrder;s[o,Y.getTech(o)]).filter(([o,u])=>u?u.isSupported():(Z.error(`The "${o}" tech is undefined. Skipped browser support check for that tech.`),!1)),s=function(o,u,c){let p;return o.some(y=>u.some(T=>{if(p=c(y,T),p)return!0})),p};let r;const n=o=>(u,c)=>o(c,u),a=([o,u],c)=>{if(u.canPlaySource(c,this.options_[o.toLowerCase()]))return{source:c,tech:o}};return this.options_.sourceOrder?r=s(e,t,n(a)):r=s(t,e,a),r||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const s=Jf(e);if(!s.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=s),this.updateSourceCaches_(s[0]),wv(this,s[0],(r,n)=>{if(this.middleware_=n,t||(this.cache_.sources=s),this.updateSourceCaches_(r),this.src_(r)){if(s.length>1)return this.handleSrc_(s.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}Av(n,this.tech_)}),s.length>1){const r=()=>{this.error(null),this.handleSrc_(s.slice(1),!0)},n=()=>{this.off("error",r)};this.one("error",r),this.one("playing",n),this.resetRetryOnError_=()=>{this.off("error",r),this.off("playing",n)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return t?jf(t.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1):!0}addSourceElement(e,t){return this.tech_?this.tech_.addSourceElement(e,t):!1}removeSourceElement(e){return this.tech_?this.tech_.removeSourceElement(e):!1}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{const e=this.play();At(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),Vt(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:s,remainingTimeDisplay:r}=this.controlBar||{},{seekBar:n}=s||{};e&&e.updateContent(),t&&t.updateContent(),r&&r.updateContent(),n&&(n.update(),n.loadProgressBar&&n.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),t=[];return Object.keys(e).length!==0&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){if(e===void 0)return this.options_.autoplay||!1;let t;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),t=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,t=typeof t>"u"?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return e!==void 0&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(e!==void 0){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(e===void 0)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){const e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}controls(e){if(e===void 0)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(e===void 0)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(e===void 0)return this.error_||null;if(ci("beforeerror").forEach(t=>{const s=t(this,e);if(!(Rt(s)&&!Array.isArray(s)||typeof s=="string"||typeof s=="number"||s===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=s}),this.options_.suppressNotSupportedError&&e&&e.code===4){const t=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),this.one("loadstart",function(){this.off(["click","touchstart"],t)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new Te(e),this.addClass("vjs-error"),Z.error(`(CODE:${this.error_.code} ${Te.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),ci("error").forEach(t=>t(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(t){t.stopPropagation(),t.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,s;const r=he(this,this.reportUserActivity),n=function(y){(y.screenX!==t||y.screenY!==s)&&(t=y.screenX,s=y.screenY,r())},a=function(){r(),this.clearInterval(e),e=this.setInterval(r,250)},o=function(y){r(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",n),this.on("mouseup",o),this.on("mouseleave",o);const u=this.getChild("controlBar");u&&!Ne&&!Tt&&(u.on("mouseenter",function(y){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),u.on("mouseleave",function(y){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r);let c;const p=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(c);const y=this.options_.inactivityTimeout;y<=0||(c=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},y))};this.setInterval(p,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){const e=this.getChild("ControlBar");!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight()||(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),s=t&&t.currentHeight();e.forEach(r=>{r!==t&&r.el_&&!r.hasClass("vjs-hidden")&&(r.hide(),this.audioOnlyCache_.hiddenChildren.push(r))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=s,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(s),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const t=[];return this.isInPictureInPicture()&&t.push(this.exitPictureInPicture()),this.isFullscreen()&&t.push(this.exitFullscreen()),this.audioPosterMode()&&t.push(this.audioPosterMode(!1)),Promise.all(t).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,t,s){if(this.tech_)return this.tech_.addTextTrack(e,t,s)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),Vt(this)&&this.trigger("languagechange"))}languages(){return ue(se.prototype.options_.languages,this.languages_)}toJSON(){const e=ue(this.options_),t=e.tracks;e.tracks=[];for(let s=0;s{this.removeChild(s)}),s.open(),s}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let s=0;sthis.addRemoteTextTrack(y,!1)),this.titleBar&&this.titleBar.update({title:p,description:a||r||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t=this.currentSources(),s=Array.prototype.map.call(this.remoteTextTracks(),n=>({kind:n.kind,label:n.label,language:n.language,src:n.src})),r={src:t,textTracks:s};return e&&(r.poster=e,r.artwork=[{src:r.poster,type:Wn(r.poster)}]),r}return ue(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},s=ni(e),r=s["data-setup"];if(ur(e,"vjs-fill")&&(s.fill=!0),ur(e,"vjs-fluid")&&(s.fluid=!0),r!==null)try{Object.assign(s,JSON.parse(r||"{}"))}catch(n){Z.error("data-setup",n)}if(Object.assign(t,s),e.hasChildNodes()){const n=e.childNodes;for(let a=0,o=n.length;atypeof t=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}se.prototype.videoTracks=()=>{};se.prototype.audioTracks=()=>{};se.prototype.textTracks=()=>{};se.prototype.remoteTextTracks=()=>{};se.prototype.remoteTextTrackEls=()=>{};He.names.forEach(function(i){const e=He[i];se.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});se.prototype.crossorigin=se.prototype.crossOrigin;se.players={};const Js=C.navigator;se.prototype.options_={techOrder:Y.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Js&&(Js.languages&&Js.languages[0]||Js.userLanguage||Js.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1,disableSeekWhileScrubbingOnMobile:!1,disableSeekWhileScrubbingOnSTV:!1};Dp.forEach(function(i){se.prototype[`handleTech${be(i)}_`]=function(){return this.trigger(i)}});B.registerComponent("Player",se);const Gn="plugin",is="activePlugins_",Yi={},Xn=i=>Yi.hasOwnProperty(i),En=i=>Xn(i)?Yi[i]:void 0,kp=(i,e)=>{i[is]=i[is]||{},i[is][e]=!0},Kn=(i,e,t)=>{const s=(t?"before":"")+"pluginsetup";i.trigger(s,e),i.trigger(s+":"+e.name,e)},m2=function(i,e){const t=function(){Kn(this,{name:i,plugin:e,instance:null},!0);const s=e.apply(this,arguments);return kp(this,i),Kn(this,{name:i,plugin:e,instance:s}),s};return Object.keys(e).forEach(function(s){t[s]=e[s]}),t},Dd=(i,e)=>(e.prototype.name=i,function(...t){Kn(this,{name:i,plugin:e,instance:null},!0);const s=new e(this,...t);return this[i]=()=>s,Kn(this,s.getEventHash()),s});class Qe{constructor(e){if(this.constructor===Qe)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Wl(this),delete this.trigger,$f(this,this.constructor.defaultState),kp(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return Es(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){const{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[is][e]=!1,this.player=this.state=null,t[e]=Dd(e,Yi[e])}static isBasic(e){const t=typeof e=="string"?En(e):e;return typeof t=="function"&&!Qe.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Xn(e))Z.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(se.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof t!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return Yi[e]=t,e!==Gn&&(Qe.isBasic(t)?se.prototype[e]=m2(e,t):se.prototype[e]=Dd(e,t)),t}static deregisterPlugin(e){if(e===Gn)throw new Error("Cannot de-register base plugin.");Xn(e)&&(delete Yi[e],delete se.prototype[e])}static getPlugins(e=Object.keys(Yi)){let t;return e.forEach(s=>{const r=En(s);r&&(t=t||{},t[s]=r)}),t}static getPluginVersion(e){const t=En(e);return t&&t.VERSION||""}}Qe.getPlugin=En;Qe.BASE_PLUGIN_NAME=Gn;Qe.registerPlugin(Gn,Qe);se.prototype.usingPlugin=function(i){return!!this[is]&&this[is][i]===!0};se.prototype.hasPlugin=function(i){return!!Xn(i)};function g2(i,e){let t=!1;return function(...s){return t||Z.warn(i),t=!0,e.apply(this,s)}}function bt(i,e,t,s){return g2(`${e} is deprecated and will be removed in ${i}.0; please use ${t} instead.`,s)}var y2={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"};const Ip=i=>i.indexOf("#")===0?i.slice(1):i;function L(i,e,t){let s=L.getPlayer(i);if(s)return e&&Z.warn(`Player "${i}" is already initialised. Options will not be applied.`),t&&s.ready(t),s;const r=typeof i=="string"?di("#"+Ip(i)):i;if(!xs(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");const a=("getRootNode"in r?r.getRootNode()instanceof C.ShadowRoot:!1)?r.getRootNode():r.ownerDocument.body;(!r.ownerDocument.defaultView||!a.contains(r))&&Z.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(r.parentNode&&r.parentNode.hasAttribute&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),ci("beforesetup").forEach(u=>{const c=u(r,ue(e));if(!Rt(c)||Array.isArray(c)){Z.error("please return an object in beforesetup hooks");return}e=ue(e,c)});const o=B.getComponent("Player");return s=new o(r,e,t),ci("setup").forEach(u=>u(s)),s}L.hooks_=$t;L.hooks=ci;L.hook=Qb;L.hookOnce=Jb;L.removeHook=hf;if(C.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&Ss()){let i=di(".vjs-styles-defaults");if(!i){i=Mf("vjs-styles-defaults");const e=di("head");e&&e.insertBefore(i,e.firstChild),Bf(i,` .video-js { width: 300px; height: 150px; } .vjs-fluid:not(.vjs-audio-only-mode) { padding-top: 56.25% } `)}}Vo(1,L);L.VERSION=qo;L.options=se.prototype.options_;L.getPlayers=()=>se.players;L.getPlayer=i=>{const e=se.players;let t;if(typeof i=="string"){const s=Ip(i),r=e[s];if(r)return r;t=di("#"+s)}else t=i;if(xs(t)){const{player:s,playerId:r}=t;if(s||e[r])return s||e[r]}};L.getAllPlayers=()=>Object.keys(se.players).map(i=>se.players[i]).filter(Boolean);L.players=se.players;L.getComponent=B.getComponent;L.registerComponent=(i,e)=>(Y.isTech(e)&&Z.warn(`The ${i} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),B.registerComponent.call(B,i,e));L.getTech=Y.getTech;L.registerTech=Y.registerTech;L.use=Cv;Object.defineProperty(L,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(L.middleware,"TERMINATOR",{value:zn,writeable:!1,enumerable:!0});L.browser=vf;L.obj=tv;L.mergeOptions=bt(9,"videojs.mergeOptions","videojs.obj.merge",ue);L.defineLazyProperty=bt(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",ha);L.bind=bt(9,"videojs.bind","native Function.prototype.bind",he);L.registerPlugin=Qe.registerPlugin;L.deregisterPlugin=Qe.deregisterPlugin;L.plugin=(i,e)=>(Z.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Qe.registerPlugin(i,e));L.getPlugins=Qe.getPlugins;L.getPlugin=Qe.getPlugin;L.getPluginVersion=Qe.getPluginVersion;L.addLanguage=function(i,e){return i=(""+i).toLowerCase(),L.options.languages=ue(L.options.languages,{[i]:e}),L.options.languages[i]};L.log=Z;L.createLogger=ff;L.time=gv;L.createTimeRange=bt(9,"videojs.createTimeRange","videojs.time.createTimeRanges",yt);L.createTimeRanges=bt(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",yt);L.formatTime=bt(9,"videojs.formatTime","videojs.time.formatTime",Ni);L.setFormatTime=bt(9,"videojs.setFormatTime","videojs.time.setFormatTime",Vf);L.resetFormatTime=bt(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",zf);L.parseUrl=bt(9,"videojs.parseUrl","videojs.url.parseUrl",Yl);L.isCrossOrigin=bt(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",Ea);L.EventTarget=ot;L.any=zl;L.on=at;L.one=Sa;L.off=Me;L.trigger=Es;L.xhr=Th;L.TrackList=Mi;L.TextTrack=kr;L.TextTrackList=Xl;L.AudioTrack=Yf;L.AudioTrackList=Gf;L.VideoTrack=Qf;L.VideoTrackList=Xf;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(i=>{L[i]=function(){return Z.warn(`videojs.${i}() is deprecated; use videojs.dom.${i}() instead`),Rf[i].apply(null,arguments)}});L.computedStyle=bt(9,"videojs.computedStyle","videojs.dom.computedStyle",Ts);L.dom=Rf;L.fn=cv;L.num=Wv;L.str=pv;L.url=xv;L.Error=y2;/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */class _2{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(s){t.enabled_(s)}}),t}}class Yn extends L.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const s=this.levels_.length;return t=new _2(e),""+s in this||Object.defineProperty(this,s,{get(){return this.levels_[s]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let s=0,r=this.length;ss&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,s=this.length;ts,i.qualityLevels.VERSION=Pp,s},Op=function(i){return T2(this,L.obj.merge({},i))};L.registerPlugin("qualityLevels",Op);Op.VERSION=Pp;/*! @name @videojs/http-streaming @version 3.17.0 @license Apache-2.0 */const Ke=aa,Qn=(i,e)=>e&&e.responseURL&&i!==e.responseURL?e.responseURL:i,ht=i=>L.log.debug?L.log.debug.bind(L,"VHS:",`${i} >`):function(){};function re(...i){const e=L.obj||L;return(e.merge||e.mergeOptions).apply(e,i)}function Pe(...i){const e=L.time||L;return(e.createTimeRanges||e.createTimeRanges).apply(e,i)}function b2(i){if(i.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges: `;for(let t=0;t ${r}. Duration (${r-s}) `}return e}const Dt=1/30,kt=Dt*3,Lp=function(i,e){const t=[];let s;if(i&&i.length)for(s=0;s=e})},yn=function(i,e){return Lp(i,function(t){return t-Dt>=e})},v2=function(i){if(i.length<2)return Pe();const e=[];for(let t=1;t{const e=[];if(!i||!i.length)return"";for(let t=0;t "+i.end(t));return e.join(", ")},x2=function(i,e,t=1){return((i.length?i.end(i.length-1):0)-e)/t},Ci=i=>{const e=[];for(let t=0;tn)){if(e>r&&e<=n){t+=n-e;continue}t+=n-r}}return t},pu=(i,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(s){t+=s.duration}),(e.preloadHints||[]).forEach(function(s){s.type==="PART"&&(t+=i.partTargetDuration)}),t},Jo=i=>(i.segments||[]).reduce((e,t,s)=>(t.parts?t.parts.forEach(function(r,n){e.push({duration:r.duration,segmentIndex:s,partIndex:n,part:r,segment:t})}):e.push({duration:t.duration,segmentIndex:s,partIndex:null,segment:t,part:null}),e),[]),Np=i=>{const e=i.segments&&i.segments.length&&i.segments[i.segments.length-1];return e&&e.parts||[]},Mp=({preloadSegment:i})=>{if(!i)return;const{parts:e,preloadHints:t}=i;let s=(t||[]).reduce((r,n)=>r+(n.type==="PART"?1:0),0);return s+=e&&e.length?e.length:0,s},Bp=(i,e)=>{if(e.endList)return 0;if(i&&i.suggestedPresentationDelay)return i.suggestedPresentationDelay;const t=Np(e).length>0;return t&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:t&&e.partTargetDuration?e.partTargetDuration*3:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?e.targetDuration*3:0},C2=function(i,e){let t=0,s=e-i.mediaSequence,r=i.segments[s];if(r){if(typeof r.start<"u")return{result:r.start,precise:!0};if(typeof r.end<"u")return{result:r.end-r.duration,precise:!0}}for(;s--;){if(r=i.segments[s],typeof r.end<"u")return{result:t+r.end,precise:!0};if(t+=pu(i,r),typeof r.start<"u")return{result:t+r.start,precise:!0}}return{result:t,precise:!1}},w2=function(i,e){let t=0,s,r=e-i.mediaSequence;for(;r"u"&&(e=i.mediaSequence+i.segments.length),e"u"){if(i.totalDuration)return i.totalDuration;if(!i.endList)return C.Infinity}return Fp(i,e,t)},hr=function({defaultDuration:i,durationList:e,startIndex:t,endIndex:s}){let r=0;if(t>s&&([t,s]=[s,t]),t<0){for(let n=t;n0)for(let c=u-1;c>=0;c--){const p=o[c];if(a+=p.duration,n){if(a<0)continue}else if(a+Dt<=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:r-hr({defaultDuration:i.targetDuration,durationList:o,startIndex:u,endIndex:c})}}return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e}}if(u<0){for(let c=u;c<0;c++)if(a-=i.targetDuration,a<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e};u=0}for(let c=u;cDt,T=a===0,x=y&&a+Dt>=0;if(!((T||x)&&c!==o.length-1)){if(n){if(a>0)continue}else if(a-Dt>=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:r+hr({defaultDuration:i.targetDuration,durationList:o,startIndex:u,endIndex:c})}}}return{segmentIndex:o[o.length-1].segmentIndex,partIndex:o[o.length-1].partIndex,startTime:e}},$p=function(i){return i.excludeUntil&&i.excludeUntil>Date.now()},mu=function(i){return i.excludeUntil&&i.excludeUntil===1/0},Da=function(i){const e=$p(i);return!i.disabled&&!e},k2=function(i){return i.disabled},I2=function(i){for(let e=0;e{if(i.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return i.playlists.filter(s=>Da(s)?(s.attributes.BANDWIDTH||0)!i&&!e||!i&&e||i&&!e?!1:!!(i===e||i.id&&e.id&&i.id===e.id||i.resolvedUri&&e.resolvedUri&&i.resolvedUri===e.resolvedUri||i.uri&&e.uri&&i.uri===e.uri),kd=function(i,e){const t=i&&i.mediaGroups&&i.mediaGroups.AUDIO||{};let s=!1;for(const r in t){for(const n in t[r])if(s=e(t[r][n]),s)break;if(s)break}return!!s},Lr=i=>{if(!i||!i.playlists||!i.playlists.length)return kd(i,t=>t.playlists&&t.playlists.length||t.uri);for(let e=0;eCh(n))||kd(i,n=>gu(t,n))))return!1}return!0};var Ye={liveEdgeDelay:Bp,duration:Up,seekable:A2,getMediaInfoForTime:D2,isEnabled:Da,isDisabled:k2,isExcluded:$p,isIncompatible:mu,playlistEnd:qp,isAes:I2,hasAttribute:jp,estimateSegmentRequestTime:P2,isLowestEnabledRendition:Zo,isAudioOnly:Lr,playlistMatch:gu,segmentDurationWithParts:pu};const{log:Hp}=L,ss=(i,e)=>`${i}-${e}`,Vp=(i,e,t)=>`placeholder-uri-${i}-${e}-${t}`,O2=({onwarn:i,oninfo:e,manifestString:t,customTagParsers:s=[],customTagMappers:r=[],llhls:n})=>{const a=new X_;i&&a.on("warn",i),e&&a.on("info",e),s.forEach(c=>a.addParser(c)),r.forEach(c=>a.addTagMapper(c)),a.push(t),a.end();const o=a.manifest;if(n||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(c){o.hasOwnProperty(c)&&delete o[c]}),o.segments&&o.segments.forEach(function(c){["parts","preloadHints"].forEach(function(p){c.hasOwnProperty(p)&&delete c[p]})})),!o.targetDuration){let c=10;o.segments&&o.segments.length&&(c=o.segments.reduce((p,y)=>Math.max(p,y.duration),0)),i&&i({message:`manifest has no targetDuration defaulting to ${c}`}),o.targetDuration=c}const u=Np(o);if(u.length&&!o.partTargetDuration){const c=u.reduce((p,y)=>Math.max(p,y.duration),0);i&&(i({message:`manifest has no partTargetDuration defaulting to ${c}`}),Hp.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),o.partTargetDuration=c}return o},Ds=(i,e)=>{i.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(i.mediaGroups[t])for(const s in i.mediaGroups[t])for(const r in i.mediaGroups[t][s]){const n=i.mediaGroups[t][s][r];e(n,t,s,r)}})},zp=({playlist:i,uri:e,id:t})=>{i.id=t,i.playlistErrors_=0,e&&(i.uri=e),i.attributes=i.attributes||{}},L2=i=>{let e=i.playlists.length;for(;e--;){const t=i.playlists[e];zp({playlist:t,id:ss(e,t.uri)}),t.resolvedUri=Ke(i.uri,t.uri),i.playlists[t.id]=t,i.playlists[t.uri]=t,t.attributes.BANDWIDTH||Hp.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},R2=i=>{Ds(i,e=>{e.uri&&(e.resolvedUri=Ke(i.uri,e.uri))})},N2=(i,e)=>{const t=ss(0,e),s={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:C.location.href,resolvedUri:C.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return s.playlists[t]=s.playlists[0],s.playlists[e]=s.playlists[0],s},Wp=(i,e,t=Vp)=>{i.uri=e;for(let r=0;r{if(!r.playlists||!r.playlists.length){if(s&&n==="AUDIO"&&!r.uri)for(let u=0;u(r.set(n.id,n),r),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},t=[];this.pendingDateRanges_.forEach((s,r)=>{if(!this.processedDateRanges_.has(r)&&(s.startTime=s.startDate.getTime()/1e3-this.offset_,s.processDateRange=()=>this.processDateRange(s),t.push(s),!!s.class))if(e[s.class]){const n=e[s.class].push(s);s.classListIndex=n-1}else e[s.class]=[s],s.classListIndex=0});for(const s of t){const r=e[s.class]||[];s.endDate?s.endTime=s.endDate.getTime()/1e3-this.offset_:s.endOnNext&&r[s.classListIndex+1]?s.endTime=r[s.classListIndex+1].startTime:s.duration?s.endTime=s.startTime+s.duration:s.plannedDuration?s.endTime=s.startTime+s.plannedDuration:s.endTime=s.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((s,r)=>{s.startDate.getTime(){const r=e.status<200||e.status>299,n=e.status>=400&&e.status<=499,a={uri:e.uri,requestType:i},o=r&&!n||s;if(t&&n)a.error=ve({},t),a.errorType=L.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=L.Error.NetworkRequestAborted;else if(e.timedout)a.erroType=L.Error.NetworkRequestTimeout;else if(o){const u=s?L.Error.NetworkBodyParserFailed:L.Error.NetworkBadStatus;a.errorType=u,a.status=e.status,a.headers=e.headers}return a},M2=ht("CodecUtils"),Xp=function(i){const e=i.attributes||{};if(e.CODECS)return Ct(e.CODECS)},Kp=(i,e)=>{const t=e.attributes||{};return i&&i.mediaGroups&&i.mediaGroups.AUDIO&&t.AUDIO&&i.mediaGroups.AUDIO[t.AUDIO]},B2=(i,e)=>{if(!Kp(i,e))return!0;const t=e.attributes||{},s=i.mediaGroups.AUDIO[t.AUDIO];for(const r in s)if(!s[r].uri&&!s[r].playlists)return!0;return!1},vr=function(i){const e={};return i.forEach(({mediaType:t,type:s,details:r})=>{e[t]=e[t]||[],e[t].push(Eh(`${s}${r}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){M2(`multiple ${t} codecs found as attributes: ${e[t].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),e[t]=null;return}e[t]=e[t][0]}),e},Pd=function(i){let e=0;return i.audio&&e++,i.video&&e++,e},fr=function(i,e){const t=e.attributes||{},s=vr(Xp(e)||[]);if(Kp(i,e)&&!s.audio&&!B2(i,e)){const r=vr(Y_(i,t.AUDIO)||[]);r.audio&&(s.audio=r.audio)}return s},{EventTarget:F2}=L,U2=(i,e)=>{if(e.endList||!e.serverControl)return i;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:s}=e;let r=e.mediaSequence+e.segments.length;if(s){const n=s.parts||[],a=Mp(e)-1;a>-1&&a!==n.length-1&&(t._HLS_part=a),(a>-1||n.length)&&r--}t._HLS_msn=r}if(e.serverControl&&e.serverControl.canSkipUntil&&(t._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(t).length){const s=new C.URL(i);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(r){t.hasOwnProperty(r)&&s.searchParams.set(r,t[r])}),i=s.toString()}return i},q2=(i,e)=>{if(!i)return e;const t=re(i,e);if(i.preloadHints&&!e.preloadHints&&delete t.preloadHints,i.parts&&!e.parts)delete t.parts;else if(i.parts&&e.parts)for(let s=0;s{const s=i.slice(),r=e.slice();t=t||0;const n=[];let a;for(let o=0;o{!i.resolvedUri&&i.uri&&(i.resolvedUri=Ke(e,i.uri)),i.key&&!i.key.resolvedUri&&(i.key.resolvedUri=Ke(e,i.key.uri)),i.map&&!i.map.resolvedUri&&(i.map.resolvedUri=Ke(e,i.map.uri)),i.map&&i.map.key&&!i.map.key.resolvedUri&&(i.map.key.resolvedUri=Ke(e,i.map.key.uri)),i.parts&&i.parts.length&&i.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=Ke(e,t.uri))}),i.preloadHints&&i.preloadHints.length&&i.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=Ke(e,t.uri))})},Qp=function(i){const e=i.segments||[],t=i.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let s=0;si===e||i.segments&&e.segments&&i.segments.length===e.segments.length&&i.endList===e.endList&&i.mediaSequence===e.mediaSequence&&i.preloadSegment===e.preloadSegment,el=(i,e,t=Jp)=>{const s=re(i,{}),r=s.playlists[e.id];if(!r||t(r,e))return null;e.segments=Qp(e);const n=re(r,e);if(n.preloadSegment&&!e.preloadSegment&&delete n.preloadSegment,r.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a{Yp(a,n.resolvedUri)});for(let a=0;a{if(a.playlists)for(let p=0;p{const t=i.segments||[],s=t[t.length-1],r=s&&s.parts&&s.parts[s.parts.length-1],n=r&&r.duration||s&&s.duration;return e&&n?n*1e3:(i.partTargetDuration||i.targetDuration||10)*500},Od=(i,e,t)=>{if(!i)return;const s=[];return i.forEach(r=>{if(!r.attributes)return;const{BANDWIDTH:n,RESOLUTION:a,CODECS:o}=r.attributes;s.push({id:r.id,bandwidth:n,resolution:a,codecs:o})}),{type:e,isLive:t,renditions:s}};class Ji extends F2{constructor(e,t,s={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=ht("PlaylistLoader");const{withCredentials:r=!1}=s;this.src=e,this.vhs_=t,this.withCredentials=r,this.addDateRangesToTextTrack_=s.addDateRangesToTextTrack;const n=t.options_;this.customTagParsers=n&&n.customTagParsers||[],this.customTagMappers=n&&n.customTagMappers||[],this.llhls=n&&n.llhls,this.dateRangesStorage_=new Id,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const t=this.dateRangesStorage_.getDateRangesToProcess();!t.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let t=Ke(this.main.uri,e.uri);this.llhls&&(t=U2(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(s,r)=>{if(this.request){if(s)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,t,s){const{uri:r,id:n}=t;this.request=null,s&&(this.state=s),this.error={playlist:this.main.playlists[n],status:e.status,message:`HLS playlist request error at URL: ${r}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:Oi({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{const s=O2({onwarn:({message:r})=>this.logger_(`m3u8-parser warn for ${e}: ${r}`),oninfo:({message:r})=>this.logger_(`m3u8-parser info for ${e}: ${r}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls});return!s.playlists||!s.playlists.length||this.excludeAudioOnlyVariants(s.playlists),s}catch(s){this.error=s,this.error.metadata={errorType:L.Error.StreamingHlsPlaylistParserError,error:s}}}excludeAudioOnlyVariants(e){const t=s=>{const r=s.attributes||{},{width:n,height:a}=r.RESOLUTION||{};if(n&&a)return!0;const o=Xp(s)||[];return!!vr(o).video};e.some(t)&&e.forEach(s=>{t(s)||(s.excludeUntil=1/0)})}haveMetadata({playlistString:e,playlistObject:t,url:s,id:r}){this.request=null,this.state="HAVE_METADATA";const n={playlistInfo:{type:"media",uri:s}};this.trigger({type:"playlistparsestart",metadata:n});const a=t||this.parseManifest_({url:s,manifestString:e});a.lastRequest=Date.now(),zp({playlist:a,uri:s,id:r});const o=el(this.main,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,o?(this.main=o,this.media_=this.main.playlists[r]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(tl(this.media(),!!o)),n.parsedPlaylist=Od(this.main.playlists,n.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:n}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),C.clearTimeout(this.mediaUpdateTimeout),C.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new Id,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof e=="string"){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(C.clearTimeout(this.finalRenditionTimeout),t){const o=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=C.setTimeout(this.media.bind(this,e,!1),o);return}const s=this.state,r=!this.media_||e.id!==this.media_.id,n=this.main.playlists[e.id];if(n&&n.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,r&&(this.trigger("mediachanging"),s==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(tl(e,!0)),!r)return;if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e;const a={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:a}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(o,u)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=Qn(e.resolvedUri,u),o)return this.playlistRequestError(this.request,e,s);this.trigger({type:"playlistrequestcomplete",metadata:a}),this.haveMetadata({playlistString:u.responseText,url:e.uri,id:e.id}),s==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(C.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),this.state==="HAVE_NOTHING"&&(this.started=!1),this.state==="SWITCHING_MEDIA"?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(C.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const s=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=C.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},s);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(C.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=C.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,typeof this.src=="object"){this.src.uri||(this.src.uri=C.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}const e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,s)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:s.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:s.responseText,code:2,metadata:Oi({requestType:s.requestType,request:s,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=Qn(this.src,s),this.trigger({type:"playlistparsestart",metadata:e});const r=this.parseManifest_({manifestString:s.responseText,url:this.src});e.parsedPlaylist=Od(r.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(r)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,Wp(this.main,this.srcUri()),e.playlists.forEach(s=>{s.segments=Qp(s),s.segments.forEach(r=>{Yp(r,s.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||C.location.href;this.main=N2(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const s=this.main,r=e.ID;let n=s.playlists.length;for(;n--;){const a=s.playlists[n];if(a.attributes["PATHWAY-ID"]===r){const o=a.resolvedUri,u=a.id;if(t){const c=this.createCloneURI_(a.resolvedUri,e),p=ss(r,c),y=this.createCloneAttributes_(r,a.attributes),T=this.createClonePlaylist_(a,p,e,y);s.playlists[n]=T,s.playlists[p]=T,s.playlists[c]=T}else s.playlists.splice(n,1);delete s.playlists[u],delete s.playlists[o]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const s=this.main,r=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{if(!(!s.mediaGroups[n]||!s.mediaGroups[n][r])){for(const a in s.mediaGroups[n])if(a===r){for(const o in s.mediaGroups[n][a])s.mediaGroups[n][a][o].playlists.forEach((c,p)=>{const y=s.playlists[c.id],T=y.id,x=y.resolvedUri;delete s.playlists[T],delete s.playlists[x]});delete s.mediaGroups[n][a]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const s=this.main,r=s.playlists.length,n=this.createCloneURI_(t.resolvedUri,e),a=ss(e.ID,n),o=this.createCloneAttributes_(e.ID,t.attributes),u=this.createClonePlaylist_(t,a,e,o);s.playlists[r]=u,s.playlists[a]=u,s.playlists[n]=u,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,s=e["BASE-ID"],r=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{if(!(!r.mediaGroups[n]||r.mediaGroups[n][t]))for(const a in r.mediaGroups[n]){if(a===s)r.mediaGroups[n][t]={};else continue;for(const o in r.mediaGroups[n][a]){const u=r.mediaGroups[n][a][o];r.mediaGroups[n][t][o]=ve({},u);const c=r.mediaGroups[n][t][o],p=this.createCloneURI_(u.resolvedUri,e);c.resolvedUri=p,c.uri=p,c.playlists=[],u.playlists.forEach((y,T)=>{const x=r.playlists[y.id],S=Vp(n,t,o),_=ss(t,S);if(x&&!r.playlists[_]){const A=this.createClonePlaylist_(x,_,e),D=A.resolvedUri;r.playlists[_]=A,r.playlists[D]=A}c.playlists[T]=this.createClonePlaylist_(y,_,e)})}}})}createClonePlaylist_(e,t,s,r){const n=this.createCloneURI_(e.resolvedUri,s),a={resolvedUri:n,uri:n,id:t};return e.segments&&(a.segments=[]),r&&(a.attributes=r),re(e,a)}createCloneURI_(e,t){const s=new URL(e);s.hostname=t["URI-REPLACEMENT"].HOST;const r=t["URI-REPLACEMENT"].PARAMS;for(const n of Object.keys(r))s.searchParams.set(n,r[n]);return s.href}createCloneAttributes_(e,t){const s={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{t[r]&&(s[r]=e)}),s}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const s in e.contentProtection){const r=e.contentProtection[s].attributes.keyId;r&&t.add(r.toLowerCase())}return t}}}const il=function(i,e,t,s){const r=i.responseType==="arraybuffer"?i.response:i.responseText;!e&&r&&(i.responseTime=Date.now(),i.roundTripTime=i.responseTime-i.requestTime,i.bytesReceived=r.byteLength||r.length,i.bandwidth||(i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3))),t.headers&&(i.responseHeaders=t.headers),e&&e.code==="ETIMEDOUT"&&(i.timedout=!0),!e&&!i.aborted&&t.statusCode!==200&&t.statusCode!==206&&t.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(i&&(r||i.responseText)))),s(e,i)},j2=(i,e)=>{if(!i||!i.size)return;let t=e;return i.forEach(s=>{t=s(t)}),t},H2=(i,e,t,s)=>{!i||!i.size||i.forEach(r=>{r(e,t,s)})},Zp=function(){const i=function e(t,s){t=re({timeout:45e3},t);const r=e.beforeRequest||L.Vhs.xhr.beforeRequest,n=e._requestCallbackSet||L.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||L.Vhs.xhr._responseCallbackSet;r&&typeof r=="function"&&(L.log.warn("beforeRequest is deprecated, use onRequest instead."),n.add(r));const o=L.Vhs.xhr.original===!0?L.xhr:L.Vhs.xhr,u=j2(n,t);n.delete(r);const c=o(u||t,function(y,T){return H2(a,c,y,T),il(c,y,T,s)}),p=c.abort;return c.abort=function(){return c.aborted=!0,p.apply(c,arguments)},c.uri=t.uri,c.requestType=t.requestType,c.requestTime=Date.now(),c};return i.original=!0,i},V2=function(i){let e;const t=i.offset;return typeof i.offset=="bigint"||typeof i.length=="bigint"?e=C.BigInt(i.offset)+C.BigInt(i.length)-C.BigInt(1):e=i.offset+i.length-1,"bytes="+t+"-"+e},sl=function(i){const e={};return i.byterange&&(e.Range=V2(i.byterange)),e},z2=function(i,e){return i.start(e)+"-"+i.end(e)},W2=function(i,e){const t=i.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},G2=function(i){return i>=32&&i<126?String.fromCharCode(i):"."},em=function(i){const e={};return Object.keys(i).forEach(t=>{const s=i[t];Ah(s)?e[t]={bytes:s.buffer,byteOffset:s.byteOffset,byteLength:s.byteLength}:e[t]=s}),e},Jn=function(i){const e=i.byterange||{length:1/0,offset:0};return[e.length,e.offset,i.resolvedUri].join(",")},tm=function(i){return i.resolvedUri},im=i=>{const e=Array.prototype.slice.call(i),t=16;let s="",r,n;for(let a=0;aim(i),K2=i=>{let e="",t;for(t=0;t{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,r=e.videoTimingInfo.transmuxedPresentationStart+t,n=i-r;return new Date(e.dateTimeObject.getTime()+n*1e3)},J2=i=>i.transmuxedPresentationEnd-i.transmuxedPresentationStart-i.transmuxerPrependedSeconds,Z2=(i,e)=>{let t;try{t=new Date(i)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let s=e.segments[0];if(to?null:(t>new Date(n)&&(s=r),{segment:s,estimatedStart:s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationStart:Ye.duration(e,e.mediaSequence+e.segments.indexOf(s)),type:s.videoTimingInfo?"accurate":"estimate"})},eS=(i,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,s;for(let n=0;nt){if(i>t+r.duration*sm)return null;s=r}return{segment:s,estimatedStart:s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationStart:t-s.duration,type:s.videoTimingInfo?"accurate":"estimate"}},tS=(i,e)=>{let t,s;try{t=new Date(i),s=new Date(e)}catch{}const r=t.getTime();return(s.getTime()-r)/1e3},iS=i=>{if(!i.segments||i.segments.length===0)return!1;for(let e=0;e{if(!t)throw new Error("getProgramTime: callback must be provided");if(!i||e===void 0)return t({message:"getProgramTime: playlist and time must be provided"});const s=eS(e,i);if(!s)return t({message:"valid programTime was not found"});if(s.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:s.estimatedStart});const r={mediaSeconds:e},n=Q2(e,s.segment);return n&&(r.programDateTime=n.toISOString()),t(null,r)},rm=({programTime:i,playlist:e,retryCount:t=2,seekTo:s,pauseAfterSeek:r=!0,tech:n,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof i>"u"||!e||!s)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!n.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!iS(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const o=Z2(i,e);if(!o)return a({message:`${i} was not found in the stream`});const u=o.segment,c=tS(u.dateTimeObject,i);if(o.type==="estimate"){if(t===0)return a({message:`${i} is not buffered yet. Try again`});s(o.estimatedStart+c),n.one("seeked",()=>{rm({programTime:i,playlist:e,retryCount:t-1,seekTo:s,pauseAfterSeek:r,tech:n,callback:a})});return}const p=u.start+c,y=()=>a(null,n.currentTime());n.one("seeked",y),r&&n.pause(),s(p)},Ao=(i,e)=>{if(i.readyState===4)return e()},rS=(i,e,t,s)=>{let r=[],n,a=!1;const o=function(y,T,x,S){return T.abort(),a=!0,t(y,T,x,S)},u=function(y,T){if(a)return;if(y)return y.metadata=Oi({requestType:s,request:T,error:y}),o(y,T,"",r);const x=T.responseText.substring(r&&r.byteLength||0,T.responseText.length);if(r=aT(r,Dh(x,!0)),n=n||rr(r),r.length<10||n&&r.lengtho(y,T,"",r));const S=ql(r);return S==="ts"&&r.length<188?Ao(T,()=>o(y,T,"",r)):!S&&r.length<376?Ao(T,()=>o(y,T,"",r)):o(null,T,S,r)},p=e({uri:i,beforeSend(y){y.overrideMimeType("text/plain; charset=x-user-defined"),y.addEventListener("progress",function({total:T,loaded:x}){return il(y,null,{statusCode:y.status},u)})}},function(y,T){return il(p,y,T,u)});return p},{EventTarget:nS}=L,Ld=function(i,e){if(!Jp(i,e)||i.sidx&&e.sidx&&(i.sidx.offset!==e.sidx.offset||i.sidx.length!==e.sidx.length))return!1;if(!i.sidx&&e.sidx||i.sidx&&!e.sidx||i.segments&&!e.segments||!i.segments&&e.segments)return!1;if(!i.segments&&!e.segments)return!0;for(let t=0;t{const r=s.attributes.NAME||t;return`placeholder-uri-${i}-${e}-${r}`},oS=({mainXml:i,srcUrl:e,clientOffset:t,sidxMapping:s,previousManifest:r})=>{const n=Db(i,{manifestUri:e,clientOffset:t,sidxMapping:s,previousManifest:r});return Wp(n,e,aS),n},lS=(i,e)=>{Ds(i,(t,s,r,n)=>{(!e.mediaGroups[s][r]||!(n in e.mediaGroups[s][r]))&&delete i.mediaGroups[s][r][n]})},uS=(i,e,t)=>{let s=!0,r=re(i,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let n=0;n{if(n.playlists&&n.playlists.length){const c=n.playlists[0].id,p=el(r,n.playlists[0],Ld);p&&(r=p,u in r.mediaGroups[a][o]||(r.mediaGroups[a][o][u]=n),r.mediaGroups[a][o][u].playlists[0]=r.playlists[c],s=!1)}}),lS(r,e),e.minimumUpdatePeriod!==i.minimumUpdatePeriod&&(s=!1),s?null:r},cS=(i,e)=>(!i.map&&!e.map||!!(i.map&&e.map&&i.map.byterange.offset===e.map.byterange.offset&&i.map.byterange.length===e.map.byterange.length))&&i.uri===e.uri&&i.byterange.offset===e.byterange.offset&&i.byterange.length===e.byterange.length,Rd=(i,e)=>{const t={};for(const s in i){const n=i[s].sidx;if(n){const a=ca(n);if(!e[a])break;const o=e[a].sidxInfo;cS(o,n)&&(t[a]=e[a])}}return t},dS=(i,e)=>{let s=Rd(i.playlists,e);return Ds(i,(r,n,a,o)=>{if(r.playlists&&r.playlists.length){const u=r.playlists;s=re(s,Rd(u,e))}}),s};class rl extends nS{constructor(e,t,s={},r){super(),this.isPaused_=!0,this.mainPlaylistLoader_=r||this,r||(this.isMain_=!0);const{withCredentials:n=!1}=s;if(this.vhs_=t,this.withCredentials=n,this.addMetadataToTextTrack=s.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=ht("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,t,s){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata},s&&(this.state=s),this.trigger("error"),!0}addSidxSegments_(e,t,s){const r=e.sidx&&ca(e.sidx);if(!e.sidx||!r||this.mainPlaylistLoader_.sidxMapping_[r]){C.clearTimeout(this.mediaRequest_),this.mediaRequest_=C.setTimeout(()=>s(!1),0);return}const n=Qn(e.sidx.resolvedUri),a=(u,c)=>{if(this.requestErrored_(u,c,t))return;const p=this.mainPlaylistLoader_.sidxMapping_,{requestType:y}=c;let T;try{T=Nb(G(c.response).subarray(8))}catch(x){x.metadata=Oi({requestType:y,request:c,parseFailure:!0}),this.requestErrored_(x,c,t);return}return p[r]={sidxInfo:e.sidx,sidx:T},Bl(e,T,e.sidx.resolvedUri),s(!0)},o="dash-sidx";this.request=rS(n,this.vhs_.xhr,(u,c,p,y)=>{if(u)return a(u,c);if(!p||p!=="mp4"){const S=p||"unknown";return a({status:c.status,message:`Unsupported ${S} container type for sidx segment at URL: ${n}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},c)}const{offset:T,length:x}=e.sidx.byterange;if(y.length>=x+T)return a(u,{response:y.subarray(T,T+x),status:c.status,uri:c.uri});this.request=this.vhs_.xhr({uri:n,responseType:"arraybuffer",requestType:"dash-sidx",headers:sl({byterange:e.sidx.byterange})},a)},o)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},C.clearTimeout(this.minimumUpdatePeriodTimeout_),C.clearTimeout(this.mediaRequest_),C.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if(typeof e=="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const s=!this.media_||e.id!==this.media_.id;if(s&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,s&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}s&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,r=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,C.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(t.id),e==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),C.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(C.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,C.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const s=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=C.setTimeout(()=>this.load(),s);return}if(!this.started){this.start();return}t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){C.clearTimeout(this.mediaRequest_),this.mediaRequest_=C.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(s,r)=>{if(s){const{requestType:a}=r;s.metadata=Oi({requestType:a,request:r,error:s})}if(this.requestErrored_(s,r)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const n=r.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=r.responseText,r.responseHeaders&&r.responseHeaders.date?this.mainLoaded_=Date.parse(r.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=Qn(this.mainPlaylistLoader_.srcUrl,r),n){this.handleMain_(),this.syncClientServerClock_(()=>e(r,n));return}return e(r,n)})}syncClientServerClock_(e){const t=kb(this.mainPlaylistLoader_.mainXml_);if(t===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(t.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e();this.request=this.vhs_.xhr({uri:Ke(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(s,r)=>{if(!this.request)return;if(s){const{requestType:a}=r;return this.error.metadata=Oi({requestType:a,request:r,error:s}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let n;t.method==="HEAD"?!r.responseHeaders||!r.responseHeaders.date?n=this.mainLoaded_:n=Date.parse(r.responseHeaders.date):n=Date.parse(r.responseText),this.mainPlaylistLoader_.clientOffset_=n-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){C.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:t});let s;try{s=oS({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(n){this.error=n,this.error.metadata={errorType:L.Error.StreamingDashManifestParserError,error:n},this.trigger("error")}e&&(s=uS(e,s,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=s||e;const r=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(r&&r!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=r),(!e||s&&s.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(s),s){const{duration:n,endList:a}=s,o=[];s.playlists.forEach(c=>{o.push({id:c.id,bandwidth:c.attributes.BANDWIDTH,resolution:c.attributes.RESOLUTION,codecs:c.attributes.CODECS})});const u={duration:n,isLive:!a,renditions:o};t.parsedManifest=u,this.trigger({type:"manifestparsecomplete",metadata:t})}return!!s}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(C.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;if(t===0&&(e.media()?t=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof t!="number"||t<=0){t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`);return}this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=C.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=dS(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,s=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,s=!this.media_||this.media_!==t[e];if(s?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const r=()=>{this.media().endList||(this.mediaUpdateTimeout=C.setTimeout(()=>{this.trigger("mediaupdatetimeout"),r()},tl(this.media(),!!s)))};r()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(s=>({cueTime:s.start,frames:[{data:s.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const s in e.contentProtection){const r=e.contentProtection[s].attributes["cenc:default_KID"];r&&t.add(r.replace(/-/g,"").toLowerCase())}return t}}}var ke={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const hS=i=>{const e=new Uint8Array(new ArrayBuffer(i.length));for(let t=0;t-1):!1},this.trigger=function(d){var f,h,m,g;if(f=l[d],!!f)if(arguments.length===2)for(m=f.length,h=0;h"u")){for(l in z)z.hasOwnProperty(l)&&(z[l]=[l.charCodeAt(0),l.charCodeAt(1),l.charCodeAt(2),l.charCodeAt(3)]);te=new Uint8Array([105,115,111,109]),ie=new Uint8Array([97,118,99,49]),Ue=new Uint8Array([0,0,0,1]),Se=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),Bt=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),pi={video:Se,audio:Bt},yi=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),gi=new Uint8Array([0,0,0,0,0,0,0,0]),Br=new Uint8Array([0,0,0,0,0,0,0,0]),Eu=Br,Cu=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),wu=Br,mi=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),o=function(l){var d=[],f=0,h,m,g;for(h=1;h>>1,l.samplingfrequencyindex<<7|l.channelcount<<3,6,1,2]))},p=function(){return o(z.ftyp,te,Ue,te,ie)},q=function(l){return o(z.hdlr,pi[l])},y=function(l){return o(z.mdat,l)},R=function(l){var d=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,l.duration>>>24&255,l.duration>>>16&255,l.duration>>>8&255,l.duration&255,85,196,0,0]);return l.samplerate&&(d[12]=l.samplerate>>>24&255,d[13]=l.samplerate>>>16&255,d[14]=l.samplerate>>>8&255,d[15]=l.samplerate&255),o(z.mdhd,d)},O=function(l){return o(z.mdia,R(l),q(l.type),x(l))},T=function(l){return o(z.mfhd,new Uint8Array([0,0,0,0,(l&4278190080)>>24,(l&16711680)>>16,(l&65280)>>8,l&255]))},x=function(l){return o(z.minf,l.type==="video"?o(z.vmhd,mi):o(z.smhd,gi),u(),$(l))},S=function(l,d){for(var f=[],h=d.length;h--;)f[h]=le(d[h]);return o.apply(null,[z.moof,T(l)].concat(f))},_=function(l){for(var d=l.length,f=[];d--;)f[d]=P(l[d]);return o.apply(null,[z.moov,D(4294967295)].concat(f).concat(A(l)))},A=function(l){for(var d=l.length,f=[];d--;)f[d]=ee(l[d]);return o.apply(null,[z.mvex].concat(f))},D=function(l){var d=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(l&4278190080)>>24,(l&16711680)>>16,(l&65280)>>8,l&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return o(z.mvhd,d)},F=function(l){var d=l.samples||[],f=new Uint8Array(4+d.length),h,m;for(m=0;m>>8),g.push(h[v].byteLength&255),g=g.concat(Array.prototype.slice.call(h[v]));for(v=0;v>>8),b.push(m[v].byteLength&255),b=b.concat(Array.prototype.slice.call(m[v]));if(E=[z.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(f.width&65280)>>8,f.width&255,(f.height&65280)>>8,f.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o(z.avcC,new Uint8Array([1,f.profileIdc,f.profileCompatibility,f.levelIdc,255].concat([h.length],g,[m.length],b))),o(z.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],f.sarRatio){var w=f.sarRatio[0],I=f.sarRatio[1];E.push(o(z.pasp,new Uint8Array([(w&4278190080)>>24,(w&16711680)>>16,(w&65280)>>8,w&255,(I&4278190080)>>24,(I&16711680)>>16,(I&65280)>>8,I&255])))}return o.apply(null,E)},d=function(f){return o(z.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(f.channelcount&65280)>>8,f.channelcount&255,(f.samplesize&65280)>>8,f.samplesize&255,0,0,0,0,(f.samplerate&65280)>>8,f.samplerate&255,0,0]),c(f))}}(),k=function(l){var d=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(l.id&4278190080)>>24,(l.id&16711680)>>16,(l.id&65280)>>8,l.id&255,0,0,0,0,(l.duration&4278190080)>>24,(l.duration&16711680)>>16,(l.duration&65280)>>8,l.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(l.width&65280)>>8,l.width&255,0,0,(l.height&65280)>>8,l.height&255,0,0]);return o(z.tkhd,d)},le=function(l){var d,f,h,m,g,b,v;return d=o(z.tfhd,new Uint8Array([0,0,0,58,(l.id&4278190080)>>24,(l.id&16711680)>>16,(l.id&65280)>>8,l.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),b=Math.floor(l.baseMediaDecodeTime/a),v=Math.floor(l.baseMediaDecodeTime%a),f=o(z.tfdt,new Uint8Array([1,0,0,0,b>>>24&255,b>>>16&255,b>>>8&255,b&255,v>>>24&255,v>>>16&255,v>>>8&255,v&255])),g=92,l.type==="audio"?(h=ce(l,g),o(z.traf,d,f,h)):(m=F(l),h=ce(l,m.length+g),o(z.traf,d,f,h,m))},P=function(l){return l.duration=l.duration||4294967295,o(z.trak,k(l),O(l))},ee=function(l){var d=new Uint8Array([0,0,0,0,(l.id&4278190080)>>24,(l.id&16711680)>>16,(l.id&65280)>>8,l.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return l.type!=="video"&&(d[d.length-1]=0),o(z.trex,d)},function(){var l,d,f;f=function(h,m){var g=0,b=0,v=0,E=0;return h.length&&(h[0].duration!==void 0&&(g=1),h[0].size!==void 0&&(b=2),h[0].flags!==void 0&&(v=4),h[0].compositionTimeOffset!==void 0&&(E=8)),[0,0,g|b|v|E,1,(h.length&4278190080)>>>24,(h.length&16711680)>>>16,(h.length&65280)>>>8,h.length&255,(m&4278190080)>>>24,(m&16711680)>>>16,(m&65280)>>>8,m&255]},d=function(h,m){var g,b,v,E,w,I;for(E=h.samples||[],m+=20+16*E.length,v=f(E,m),b=new Uint8Array(v.length+E.length*16),b.set(v),g=v.length,I=0;I>>24,b[g++]=(w.duration&16711680)>>>16,b[g++]=(w.duration&65280)>>>8,b[g++]=w.duration&255,b[g++]=(w.size&4278190080)>>>24,b[g++]=(w.size&16711680)>>>16,b[g++]=(w.size&65280)>>>8,b[g++]=w.size&255,b[g++]=w.flags.isLeading<<2|w.flags.dependsOn,b[g++]=w.flags.isDependedOn<<6|w.flags.hasRedundancy<<4|w.flags.paddingValue<<1|w.flags.isNonSyncSample,b[g++]=w.flags.degradationPriority&61440,b[g++]=w.flags.degradationPriority&15,b[g++]=(w.compositionTimeOffset&4278190080)>>>24,b[g++]=(w.compositionTimeOffset&16711680)>>>16,b[g++]=(w.compositionTimeOffset&65280)>>>8,b[g++]=w.compositionTimeOffset&255;return o(z.trun,b)},l=function(h,m){var g,b,v,E,w,I;for(E=h.samples||[],m+=20+8*E.length,v=f(E,m),g=new Uint8Array(v.length+E.length*8),g.set(v),b=v.length,I=0;I>>24,g[b++]=(w.duration&16711680)>>>16,g[b++]=(w.duration&65280)>>>8,g[b++]=w.duration&255,g[b++]=(w.size&4278190080)>>>24,g[b++]=(w.size&16711680)>>>16,g[b++]=(w.size&65280)>>>8,g[b++]=w.size&255;return o(z.trun,g)},ce=function(h,m){return h.type==="audio"?l(h,m):d(h,m)}}();var Sg={ftyp:p,mdat:y,moof:S,moov:_,initSegment:function(l){var d=p(),f=_(l),h;return h=new Uint8Array(d.byteLength+f.byteLength),h.set(d),h.set(f,d.byteLength),h}},xg=function(l){var d,f,h=[],m=[];for(m.byteLength=0,m.nalCount=0,m.duration=0,h.byteLength=0,d=0;d1&&(d=l.shift(),l.byteLength-=d.byteLength,l.nalCount-=d.nalCount,l[0][0].dts=d.dts,l[0][0].pts=d.pts,l[0][0].duration+=d.duration),l},wg=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Au=function(l,d){var f=wg();return f.dataOffset=d,f.compositionTimeOffset=l.pts-l.dts,f.duration=l.duration,f.size=4*l.length,f.size+=l.byteLength,l.keyFrame&&(f.flags.dependsOn=2,f.flags.isNonSyncSample=0),f},Ag=function(l,d){var f,h,m,g,b,v=d||0,E=[];for(f=0;fUr.ONE_SECOND_IN_TS/2))){for(w=Rg()[l.samplerate],w||(w=d[0].data),I=0;I=f?l:(d.minSegmentDts=1/0,l.filter(function(h){return h.dts>=f?(d.minSegmentDts=Math.min(d.minSegmentDts,h.dts),d.minSegmentPts=d.minSegmentDts,!0):!1}))},Fg=function(l){var d,f,h=[];for(d=0;d=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(l),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Ft.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},Ft.prototype.addText=function(l){this.rows[this.rowIdx]+=l},Ft.prototype.backspace=function(){if(!this.isEmpty()){var l=this.rows[this.rowIdx];this.rows[this.rowIdx]=l.substr(0,l.length-1)}};var jr=function(l,d,f){this.serviceNum=l,this.text="",this.currentWindow=new Ft(-1),this.windows=[],this.stream=f,typeof d=="string"&&this.createTextDecoder(d)};jr.prototype.init=function(l,d){this.startPts=l;for(var f=0;f<8;f++)this.windows[f]=new Ft(f),typeof d=="function"&&(this.windows[f].beforeRowOverflow=d)},jr.prototype.setCurrentWindow=function(l){this.currentWindow=this.windows[l]},jr.prototype.createTextDecoder=function(l){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(l)}catch(d){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+l+" encoding. "+d})}};var de=function(l){l=l||{},de.prototype.init.call(this);var d=this,f=l.captionServices||{},h={},m;Object.keys(f).forEach(g=>{m=f[g],/^SERVICE/.test(g)&&(h[g]=m.encoding)}),this.serviceEncodings=h,this.current708Packet=null,this.services={},this.push=function(g){g.type===3?(d.new708Packet(),d.add708Bytes(g)):(d.current708Packet===null&&d.new708Packet(),d.add708Bytes(g))}};de.prototype=new za,de.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},de.prototype.add708Bytes=function(l){var d=l.ccData,f=d>>>8,h=d&255;this.current708Packet.ptsVals.push(l.pts),this.current708Packet.data.push(f),this.current708Packet.data.push(h)},de.prototype.push708Packet=function(){var l=this.current708Packet,d=l.data,f=null,h=null,m=0,g=d[m++];for(l.seq=g>>6,l.sizeCode=g&63;m>5,h=g&31,f===7&&h>0&&(g=d[m++],f=g),this.pushServiceBlock(f,m,h),h>0&&(m+=h-1)},de.prototype.pushServiceBlock=function(l,d,f){var h,m=d,g=this.current708Packet.data,b=this.services[l];for(b||(b=this.initService(l,m));m("0"+(W&255).toString(16)).slice(-2)).join("")}if(m?(N=[v,E],l++):N=[v],d.textDecoder_&&!h)I=d.textDecoder_.decode(new Uint8Array(N));else if(m){const U=H(N);I=String.fromCharCode(parseInt(U,16))}else I=Jg(b|v);return w.pendingNewLine&&!w.isEmpty()&&w.newLine(this.getPts(l)),w.pendingNewLine=!1,w.addText(I),l},de.prototype.multiByteCharacter=function(l,d){var f=this.current708Packet.data,h=f[l+1],m=f[l+2];return $r(h)&&$r(m)&&(l=this.handleText(++l,d,{isMultiByte:!0})),l},de.prototype.setCurrentWindow=function(l,d){var f=this.current708Packet.data,h=f[l],m=h&7;return d.setCurrentWindow(m),l},de.prototype.defineWindow=function(l,d){var f=this.current708Packet.data,h=f[l],m=h&7;d.setCurrentWindow(m);var g=d.currentWindow;return h=f[++l],g.visible=(h&32)>>5,g.rowLock=(h&16)>>4,g.columnLock=(h&8)>>3,g.priority=h&7,h=f[++l],g.relativePositioning=(h&128)>>7,g.anchorVertical=h&127,h=f[++l],g.anchorHorizontal=h,h=f[++l],g.anchorPoint=(h&240)>>4,g.rowCount=h&15,h=f[++l],g.columnCount=h&63,h=f[++l],g.windowStyle=(h&56)>>3,g.penStyle=h&7,g.virtualRowCount=g.rowCount+1,l},de.prototype.setWindowAttributes=function(l,d){var f=this.current708Packet.data,h=f[l],m=d.currentWindow.winAttr;return h=f[++l],m.fillOpacity=(h&192)>>6,m.fillRed=(h&48)>>4,m.fillGreen=(h&12)>>2,m.fillBlue=h&3,h=f[++l],m.borderType=(h&192)>>6,m.borderRed=(h&48)>>4,m.borderGreen=(h&12)>>2,m.borderBlue=h&3,h=f[++l],m.borderType+=(h&128)>>5,m.wordWrap=(h&64)>>6,m.printDirection=(h&48)>>4,m.scrollDirection=(h&12)>>2,m.justify=h&3,h=f[++l],m.effectSpeed=(h&240)>>4,m.effectDirection=(h&12)>>2,m.displayEffect=h&3,l},de.prototype.flushDisplayed=function(l,d){for(var f=[],h=0;h<8;h++)d.windows[h].visible&&!d.windows[h].isEmpty()&&f.push(d.windows[h].getText());d.endPts=l,d.text=f.join(` `),this.pushCaption(d),d.startPts=l},de.prototype.pushCaption=function(l){l.text!==""&&(this.trigger("data",{startPts:l.startPts,endPts:l.endPts,text:l.text,stream:"cc708_"+l.serviceNum}),l.text="",l.startPts=l.endPts)},de.prototype.displayWindows=function(l,d){var f=this.current708Packet.data,h=f[++l],m=this.getPts(l);this.flushDisplayed(m,d);for(var g=0;g<8;g++)h&1<>4,m.offset=(h&12)>>2,m.penSize=h&3,h=f[++l],m.italics=(h&128)>>7,m.underline=(h&64)>>6,m.edgeType=(h&56)>>3,m.fontStyle=h&7,l},de.prototype.setPenColor=function(l,d){var f=this.current708Packet.data,h=f[l],m=d.currentWindow.penColor;return h=f[++l],m.fgOpacity=(h&192)>>6,m.fgRed=(h&48)>>4,m.fgGreen=(h&12)>>2,m.fgBlue=h&3,h=f[++l],m.bgOpacity=(h&192)>>6,m.bgRed=(h&48)>>4,m.bgGreen=(h&12)>>2,m.bgBlue=h&3,h=f[++l],m.edgeRed=(h&48)>>4,m.edgeGreen=(h&12)>>2,m.edgeBlue=h&3,l},de.prototype.setPenLocation=function(l,d){var f=this.current708Packet.data,h=f[l],m=d.currentWindow.penLoc;return d.currentWindow.pendingNewLine=!0,h=f[++l],m.row=h&15,h=f[++l],m.column=h&63,l},de.prototype.reset=function(l,d){var f=this.getPts(l);return this.flushDisplayed(f,d),this.initService(d.serviceNum,l)};var Zg={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Hr=function(l){return l===null?"":(l=Zg[l]||l,String.fromCharCode(l))},Vr=14,e0=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],_i=function(){for(var l=[],d=Vr+1;d--;)l.push({text:"",indent:0,offset:0});return l},me=function(l,d){me.prototype.init.call(this),this.field_=l||0,this.dataChannel_=d||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(f){var h,m,g,b,v;if(h=f.ccData&32639,h===this.lastControlCode_){this.lastControlCode_=null;return}if((h&61440)===4096?this.lastControlCode_=h:h!==this.PADDING_&&(this.lastControlCode_=null),g=h>>>8,b=h&255,h!==this.PADDING_)if(h===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(h===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(f.pts),this.flushDisplayed(f.pts),m=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=m,this.startPts_=f.pts;else if(h===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(f.pts);else if(h===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(f.pts);else if(h===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(f.pts);else if(h===this.CARRIAGE_RETURN_)this.clearFormatting(f.pts),this.flushDisplayed(f.pts),this.shiftRowsUp_(),this.startPts_=f.pts;else if(h===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(h===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(f.pts),this.displayed_=_i();else if(h===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=_i();else if(h===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(f.pts),this.displayed_=_i()),this.mode_="paintOn",this.startPts_=f.pts;else if(this.isSpecialCharacter(g,b))g=(g&3)<<8,v=Hr(g|b),this[this.mode_](f.pts,v),this.column_++;else if(this.isExtCharacter(g,b))this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),g=(g&3)<<8,v=Hr(g|b),this[this.mode_](f.pts,v),this.column_++;else if(this.isMidRowCode(g,b))this.clearFormatting(f.pts),this[this.mode_](f.pts," "),this.column_++,(b&14)===14&&this.addFormatting(f.pts,["i"]),(b&1)===1&&this.addFormatting(f.pts,["u"]);else if(this.isOffsetControlCode(g,b)){const w=b&3;this.nonDisplayed_[this.row_].offset=w,this.column_+=w}else if(this.isPAC(g,b)){var E=e0.indexOf(h&7968);if(this.mode_==="rollUp"&&(E-this.rollUpRows_+1<0&&(E=this.rollUpRows_-1),this.setRollUp(f.pts,E)),E!==this.row_&&E>=0&&E<=14&&(this.clearFormatting(f.pts),this.row_=E),b&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(f.pts,["u"]),(h&16)===16){const w=(h&14)>>1;this.column_=w*4,this.nonDisplayed_[this.row_].indent+=w}this.isColorPAC(b)&&(b&14)===14&&this.addFormatting(f.pts,["i"])}else this.isNormalChar(g)&&(b===0&&(b=null),v=Hr(g),v+=Hr(b),this[this.mode_](f.pts,v),this.column_+=v.length)}};me.prototype=new za,me.prototype.flushDisplayed=function(l){const d=h=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+h+"."})},f=[];this.displayed_.forEach((h,m)=>{if(h&&h.text&&h.text.length){try{h.text=h.text.trim()}catch{d(m)}h.text.length&&f.push({text:h.text,line:m+1,position:10+Math.min(70,h.indent*10)+h.offset*2.5})}else h==null&&d(m)}),f.length&&this.trigger("data",{startPts:this.startPts_,endPts:l,content:f,stream:this.name_})},me.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=_i(),this.nonDisplayed_=_i(),this.lastControlCode_=null,this.column_=0,this.row_=Vr,this.rollUpRows_=2,this.formatting_=[]},me.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},me.prototype.isSpecialCharacter=function(l,d){return l===this.EXT_&&d>=48&&d<=63},me.prototype.isExtCharacter=function(l,d){return(l===this.EXT_+1||l===this.EXT_+2)&&d>=32&&d<=63},me.prototype.isMidRowCode=function(l,d){return l===this.EXT_&&d>=32&&d<=47},me.prototype.isOffsetControlCode=function(l,d){return l===this.OFFSET_&&d>=33&&d<=35},me.prototype.isPAC=function(l,d){return l>=this.BASE_&&l=64&&d<=127},me.prototype.isColorPAC=function(l){return l>=64&&l<=79||l>=96&&l<=127},me.prototype.isNormalChar=function(l){return l>=32&&l<=127},me.prototype.setRollUp=function(l,d){if(this.mode_!=="rollUp"&&(this.row_=Vr,this.mode_="rollUp",this.flushDisplayed(l),this.nonDisplayed_=_i(),this.displayed_=_i()),d!==void 0&&d!==this.row_)for(var f=0;f"},"");this[this.mode_](l,f)},me.prototype.clearFormatting=function(l){if(this.formatting_.length){var d=this.formatting_.reverse().reduce(function(f,h){return f+""},"");this.formatting_=[],this[this.mode_](l,d)}},me.prototype.popOn=function(l,d){var f=this.nonDisplayed_[this.row_].text;f+=d,this.nonDisplayed_[this.row_].text=f},me.prototype.rollUp=function(l,d){var f=this.displayed_[this.row_].text;f+=d,this.displayed_[this.row_].text=f},me.prototype.shiftRowsUp_=function(){var l;for(l=0;ld&&(f=-1);Math.abs(d-l)>s0;)l+=f*i0;return l},Ga=function(l){var d,f;Ga.prototype.init.call(this),this.type_=l||Ru,this.push=function(h){if(h.type==="metadata"){this.trigger("data",h);return}this.type_!==Ru&&h.type!==this.type_||(f===void 0&&(f=h.dts),h.dts=Wa(h.dts,f),h.pts=Wa(h.pts,f),d=h.dts,this.trigger("data",h))},this.flush=function(){f=d,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){f=void 0,d=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Ga.prototype=new t0;var Nu={TimestampRolloverStream:Ga,handleRollover:Wa},r0=(l,d,f)=>{if(!l)return-1;for(var h=f;h";l.data[0]===Gr.Utf8&&(f=Wr(l.data,0,d),!(f<0)&&(l.mimeType=Os(l.data,d,f),d=f+1,l.pictureType=l.data[d],d++,h=Wr(l.data,0,d),!(h<0)&&(l.description=Ps(l.data,d,h),d=h+1,l.mimeType===m?l.url=Os(l.data,d,l.data.length):l.pictureData=l.data.subarray(d,l.data.length))))},"T*":function(l){l.data[0]===Gr.Utf8&&(l.value=Ps(l.data,1,l.data.length).replace(/\0*$/,""),l.values=l.value.split("\0"))},TXXX:function(l){var d;l.data[0]===Gr.Utf8&&(d=Wr(l.data,0,1),d!==-1&&(l.description=Ps(l.data,1,d),l.value=Ps(l.data,d+1,l.data.length).replace(/\0*$/,""),l.data=l.value))},"W*":function(l){l.url=Os(l.data,0,l.data.length).replace(/\0.*$/,"")},WXXX:function(l){var d;l.data[0]===Gr.Utf8&&(d=Wr(l.data,0,1),d!==-1&&(l.description=Ps(l.data,1,d),l.url=Os(l.data,d+1,l.data.length).replace(/\0.*$/,"")))},PRIV:function(l){var d;for(d=0;d>>2;W*=4,W+=U[7]&3,I.timeStamp=W,v.pts===void 0&&v.dts===void 0&&(v.pts=I.timeStamp,v.dts=I.timeStamp),this.trigger("timestamp",I)}v.frames.push(I),E+=10,E+=w}while(E>>4>1&&(b+=m[b]+1),g.pid===0)g.type="pat",l(m.subarray(b),g),this.trigger("data",g);else if(g.pid===this.pmtPid)for(g.type="pmt",l(m.subarray(b),g),this.trigger("data",g);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([m,b,g]):this.processPes_(m,b,g)},this.processPes_=function(m,g,b){b.pid===this.programMapTable.video?b.streamType=ft.H264_STREAM_TYPE:b.pid===this.programMapTable.audio?b.streamType=ft.ADTS_STREAM_TYPE:b.streamType=this.programMapTable["timed-metadata"][b.pid],b.type="pes",b.data=m.subarray(g),this.trigger("data",b)}},Ns.prototype=new Xa,Ns.STREAM_TYPES={h264:27,adts:15},Yr=function(){var l=this,d=!1,f={data:[],size:0},h={data:[],size:0},m={data:[],size:0},g,b=function(E,w){var I;const N=E[0]<<16|E[1]<<8|E[2];w.data=new Uint8Array,N===1&&(w.packetLength=6+(E[4]<<8|E[5]),w.dataAlignmentIndicator=(E[6]&4)!==0,I=E[7],I&192&&(w.pts=(E[9]&14)<<27|(E[10]&255)<<20|(E[11]&254)<<12|(E[12]&255)<<5|(E[13]&254)>>>3,w.pts*=4,w.pts+=(E[13]&6)>>>1,w.dts=w.pts,I&64&&(w.dts=(E[14]&14)<<27|(E[15]&255)<<20|(E[16]&254)<<12|(E[17]&255)<<5|(E[18]&254)>>>3,w.dts*=4,w.dts+=(E[18]&6)>>>1)),w.data=E.subarray(9+E[8]))},v=function(E,w,I){var N=new Uint8Array(E.size),H={type:w},U=0,W=0,J=!1,De;if(!(!E.data.length||E.size<9)){for(H.trackId=E.data[0].pid,U=0;U>5,E=((d[m+6]&3)+1)*1024,w=E*f0/Uu[(d[m+2]&60)>>>2],d.byteLength-m>>6&3)+1,channelcount:(d[m+2]&1)<<2|(d[m+3]&192)>>>6,samplerate:Uu[(d[m+2]&60)>>>2],samplingfrequencyindex:(d[m+2]&60)>>>2,samplesize:16,data:d.subarray(m+7+b,m+g)}),f++,m+=g}typeof I=="number"&&(this.skipWarn_(I,m),I=null),d=d.subarray(m)}},this.flush=function(){f=0,this.trigger("done")},this.reset=function(){d=void 0,this.trigger("reset")},this.endTimeline=function(){d=void 0,this.trigger("endedtimeline")}},Qr.prototype=new h0;var p0=Qr,qu;qu=function(l){var d=l.byteLength,f=0,h=0;this.length=function(){return 8*d},this.bitsAvailable=function(){return 8*d+h},this.loadWord=function(){var m=l.byteLength-d,g=new Uint8Array(4),b=Math.min(4,d);if(b===0)throw new Error("no bytes available");g.set(l.subarray(m,m+b)),f=new DataView(g.buffer).getUint32(0),h=b*8,d-=b},this.skipBits=function(m){var g;h>m?(f<<=m,h-=m):(m-=h,g=Math.floor(m/8),m-=g*8,d-=g,this.loadWord(),f<<=m,h-=m)},this.readBits=function(m){var g=Math.min(h,m),b=f>>>32-g;return h-=g,h>0?f<<=g:d>0&&this.loadWord(),g=m-g,g>0?b<>>m)return f<<=m,h-=m,m;return this.loadWord(),m+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var m=this.skipLeadingZeros();return this.readBits(m+1)-1},this.readExpGolomb=function(){var m=this.readUnsignedExpGolomb();return 1&m?1+m>>>1:-1*(m>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var m0=qu,$u=t,g0=m0,Jr,Zr,ju;Zr=function(){var l=0,d,f;Zr.prototype.init.call(this),this.push=function(h){var m;f?(m=new Uint8Array(f.byteLength+h.data.byteLength),m.set(f),m.set(h.data,f.byteLength),f=m):f=h.data;for(var g=f.byteLength;l3&&this.trigger("data",f.subarray(l+3)),f=null,l=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},Zr.prototype=new $u,ju={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},Jr=function(){var l=new Zr,d,f,h,m,g,b,v;Jr.prototype.init.call(this),d=this,this.push=function(E){E.type==="video"&&(f=E.trackId,h=E.pts,m=E.dts,l.push(E))},l.on("data",function(E){var w={trackId:f,pts:h,dts:m,data:E,nalUnitTypeCode:E[0]&31};switch(w.nalUnitTypeCode){case 5:w.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:w.nalUnitType="sei_rbsp",w.escapedRBSP=g(E.subarray(1));break;case 7:w.nalUnitType="seq_parameter_set_rbsp",w.escapedRBSP=g(E.subarray(1)),w.config=b(w.escapedRBSP);break;case 8:w.nalUnitType="pic_parameter_set_rbsp";break;case 9:w.nalUnitType="access_unit_delimiter_rbsp";break}d.trigger("data",w)}),l.on("done",function(){d.trigger("done")}),l.on("partialdone",function(){d.trigger("partialdone")}),l.on("reset",function(){d.trigger("reset")}),l.on("endedtimeline",function(){d.trigger("endedtimeline")}),this.flush=function(){l.flush()},this.partialFlush=function(){l.partialFlush()},this.reset=function(){l.reset()},this.endTimeline=function(){l.endTimeline()},v=function(E,w){var I=8,N=8,H,U;for(H=0;H>4;return f=f>=0?f:0,m?f+20:f+10},Vu=function(l,d){return l.length-d<10||l[d]!==73||l[d+1]!==68||l[d+2]!==51?d:(d+=Hu(l,d),Vu(l,d))},T0=function(l){var d=Vu(l,0);return l.length>=d+2&&(l[d]&255)===255&&(l[d+1]&240)===240&&(l[d+1]&22)===16},zu=function(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]},b0=function(l,d,f){var h,m="";for(h=d;h>5,h=l[d+4]<<3,m=l[d+3]&6144;return m|h|f},x0=function(l,d){return l[d]===73&&l[d+1]===68&&l[d+2]===51?"timed-metadata":l[d]&!0&&(l[d+1]&240)===240?"audio":null},E0=function(l){for(var d=0;d+5>>2]}return null},C0=function(l){var d,f,h,m;d=10,l[5]&64&&(d+=4,d+=zu(l.subarray(10,14)));do{if(f=zu(l.subarray(d+4,d+8)),f<1)return null;if(m=String.fromCharCode(l[d],l[d+1],l[d+2],l[d+3]),m==="PRIV"){h=l.subarray(d+10,d+f+10);for(var g=0;g>>2;return E*=4,E+=v[7]&3,E}break}}d+=10,d+=f}while(d=3;){if(l[m]===73&&l[m+1]===68&&l[m+2]===51){if(l.length-m<10||(h=Wu.parseId3TagSize(l,m),m+h>l.length))break;b={type:"timed-metadata",data:l.subarray(m,m+h)},this.trigger("data",b),m+=h;continue}else if((l[m]&255)===255&&(l[m+1]&240)===240){if(l.length-m<7||(h=Wu.parseAdtsSize(l,m),m+h>l.length))break;v={type:"audio",data:l.subarray(m,m+h),pts:d,dts:d},this.trigger("data",v),m+=h;continue}m++}g=l.length-m,g>0?l=l.subarray(m):l=new Uint8Array},this.reset=function(){l=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){l=new Uint8Array,this.trigger("endedtimeline")}},en.prototype=new w0;var A0=en,D0=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],k0=D0,I0=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],P0=I0,tn=t,Ms=Sg,Bs=Pg,sn=qg,pt=zg,Ut=d0,rn=fe,Gu=p0,O0=y0.H264Stream,L0=A0,R0=Ja.isLikelyAacData,N0=fe.ONE_SECOND_IN_TS,Xu=k0,Ku=P0,nn,Fs,an,Ti,M0=function(l,d){d.stream=l,this.trigger("log",d)},Yu=function(l,d){for(var f=Object.keys(d),h=0;h=-1e4&&I<=E&&(!N||w>I)&&(N=U,w=I)));return N?N.gop:null},this.alignGopsAtStart_=function(v){var E,w,I,N,H,U,W,J;for(H=v.byteLength,U=v.nalCount,W=v.duration,E=w=0;EI.pts){E++;continue}w++,H-=N.byteLength,U-=N.nalCount,W-=N.duration}return w===0?v:w===v.length?null:(J=v.slice(w),J.byteLength=H,J.duration=W,J.nalCount=U,J.pts=J[0].pts,J.dts=J[0].dts,J)},this.alignGopsAtEnd_=function(v){var E,w,I,N,H,U;for(E=m.length-1,w=v.length-1,H=null,U=!1;E>=0&&w>=0;){if(I=m[E],N=v[w],I.pts===N.pts){U=!0;break}if(I.pts>N.pts){E--;continue}E===m.length-1&&(H=w),w--}if(!U&&H===null)return null;var W;if(U?W=w:W=H,W===0)return v;var J=v.slice(W),De=J.reduce(function(it,Zt){return it.byteLength+=Zt.byteLength,it.duration+=Zt.duration,it.nalCount+=Zt.nalCount,it},{byteLength:0,duration:0,nalCount:0});return J.byteLength=De.byteLength,J.duration=De.duration,J.nalCount=De.nalCount,J.pts=J[0].pts,J.dts=J[0].dts,J},this.alignGopsWith=function(v){m=v}},nn.prototype=new tn,Ti=function(l,d){this.numberOfTracks=0,this.metadataStream=d,l=l||{},typeof l.remux<"u"?this.remuxTracks=!!l.remux:this.remuxTracks=!0,typeof l.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=l.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Ti.prototype.init.call(this),this.push=function(f){if(f.content||f.text)return this.pendingCaptions.push(f);if(f.frames)return this.pendingMetadata.push(f);this.pendingTracks.push(f.track),this.pendingBytes+=f.boxes.byteLength,f.track.type==="video"&&(this.videoTrack=f.track,this.pendingBoxes.push(f.boxes)),f.track.type==="audio"&&(this.audioTrack=f.track,this.pendingBoxes.unshift(f.boxes))}},Ti.prototype=new tn,Ti.prototype.flush=function(l){var d=0,f={captions:[],captionStreams:{},metadata:[],info:{}},h,m,g,b=0,v;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(b=this.videoTrack.timelineStartInfo.pts,Ku.forEach(function(E){f.info[E]=this.videoTrack[E]},this)):this.audioTrack&&(b=this.audioTrack.timelineStartInfo.pts,Xu.forEach(function(E){f.info[E]=this.audioTrack[E]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?f.type=this.pendingTracks[0].type:f.type="combined",this.emittedTracks+=this.pendingTracks.length,g=Ms.initSegment(this.pendingTracks),f.initSegment=new Uint8Array(g.byteLength),f.initSegment.set(g),f.data=new Uint8Array(this.pendingBytes),v=0;v=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Ti.prototype.setRemux=function(l){this.remuxTracks=l},an=function(l){var d=this,f=!0,h,m;an.prototype.init.call(this),l=l||{},this.baseMediaDecodeTime=l.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var g={};this.transmuxPipeline_=g,g.type="aac",g.metadataStream=new Ut.MetadataStream,g.aacStream=new L0,g.audioTimestampRolloverStream=new Ut.TimestampRolloverStream("audio"),g.timedMetadataTimestampRolloverStream=new Ut.TimestampRolloverStream("timed-metadata"),g.adtsStream=new Gu,g.coalesceStream=new Ti(l,g.metadataStream),g.headOfPipeline=g.aacStream,g.aacStream.pipe(g.audioTimestampRolloverStream).pipe(g.adtsStream),g.aacStream.pipe(g.timedMetadataTimestampRolloverStream).pipe(g.metadataStream).pipe(g.coalesceStream),g.metadataStream.on("timestamp",function(b){g.aacStream.setTimestamp(b.timeStamp)}),g.aacStream.on("data",function(b){b.type!=="timed-metadata"&&b.type!=="audio"||g.audioSegmentStream||(m=m||{timelineStartInfo:{baseMediaDecodeTime:d.baseMediaDecodeTime},codec:"adts",type:"audio"},g.coalesceStream.numberOfTracks++,g.audioSegmentStream=new Fs(m,l),g.audioSegmentStream.on("log",d.getLogTrigger_("audioSegmentStream")),g.audioSegmentStream.on("timingInfo",d.trigger.bind(d,"audioTimingInfo")),g.adtsStream.pipe(g.audioSegmentStream).pipe(g.coalesceStream),d.trigger("trackinfo",{hasAudio:!!m,hasVideo:!!h}))}),g.coalesceStream.on("data",this.trigger.bind(this,"data")),g.coalesceStream.on("done",this.trigger.bind(this,"done")),Yu(this,g)},this.setupTsPipeline=function(){var g={};this.transmuxPipeline_=g,g.type="ts",g.metadataStream=new Ut.MetadataStream,g.packetStream=new Ut.TransportPacketStream,g.parseStream=new Ut.TransportParseStream,g.elementaryStream=new Ut.ElementaryStream,g.timestampRolloverStream=new Ut.TimestampRolloverStream,g.adtsStream=new Gu,g.h264Stream=new O0,g.captionStream=new Ut.CaptionStream(l),g.coalesceStream=new Ti(l,g.metadataStream),g.headOfPipeline=g.packetStream,g.packetStream.pipe(g.parseStream).pipe(g.elementaryStream).pipe(g.timestampRolloverStream),g.timestampRolloverStream.pipe(g.h264Stream),g.timestampRolloverStream.pipe(g.adtsStream),g.timestampRolloverStream.pipe(g.metadataStream).pipe(g.coalesceStream),g.h264Stream.pipe(g.captionStream).pipe(g.coalesceStream),g.elementaryStream.on("data",function(b){var v;if(b.type==="metadata"){for(v=b.tracks.length;v--;)!h&&b.tracks[v].type==="video"?(h=b.tracks[v],h.timelineStartInfo.baseMediaDecodeTime=d.baseMediaDecodeTime):!m&&b.tracks[v].type==="audio"&&(m=b.tracks[v],m.timelineStartInfo.baseMediaDecodeTime=d.baseMediaDecodeTime);h&&!g.videoSegmentStream&&(g.coalesceStream.numberOfTracks++,g.videoSegmentStream=new nn(h,l),g.videoSegmentStream.on("log",d.getLogTrigger_("videoSegmentStream")),g.videoSegmentStream.on("timelineStartInfo",function(E){m&&!l.keepOriginalTimestamps&&(m.timelineStartInfo=E,g.audioSegmentStream.setEarliestDts(E.dts-d.baseMediaDecodeTime))}),g.videoSegmentStream.on("processedGopsInfo",d.trigger.bind(d,"gopInfo")),g.videoSegmentStream.on("segmentTimingInfo",d.trigger.bind(d,"videoSegmentTimingInfo")),g.videoSegmentStream.on("baseMediaDecodeTime",function(E){m&&g.audioSegmentStream.setVideoBaseMediaDecodeTime(E)}),g.videoSegmentStream.on("timingInfo",d.trigger.bind(d,"videoTimingInfo")),g.h264Stream.pipe(g.videoSegmentStream).pipe(g.coalesceStream)),m&&!g.audioSegmentStream&&(g.coalesceStream.numberOfTracks++,g.audioSegmentStream=new Fs(m,l),g.audioSegmentStream.on("log",d.getLogTrigger_("audioSegmentStream")),g.audioSegmentStream.on("timingInfo",d.trigger.bind(d,"audioTimingInfo")),g.audioSegmentStream.on("segmentTimingInfo",d.trigger.bind(d,"audioSegmentTimingInfo")),g.adtsStream.pipe(g.audioSegmentStream).pipe(g.coalesceStream)),d.trigger("trackinfo",{hasAudio:!!m,hasVideo:!!h})}}),g.coalesceStream.on("data",this.trigger.bind(this,"data")),g.coalesceStream.on("id3Frame",function(b){b.dispatchType=g.metadataStream.dispatchType,d.trigger("id3Frame",b)}),g.coalesceStream.on("caption",this.trigger.bind(this,"caption")),g.coalesceStream.on("done",this.trigger.bind(this,"done")),Yu(this,g)},this.setBaseMediaDecodeTime=function(g){var b=this.transmuxPipeline_;l.keepOriginalTimestamps||(this.baseMediaDecodeTime=g),m&&(m.timelineStartInfo.dts=void 0,m.timelineStartInfo.pts=void 0,pt.clearDtsInfo(m),b.audioTimestampRolloverStream&&b.audioTimestampRolloverStream.discontinuity()),h&&(b.videoSegmentStream&&(b.videoSegmentStream.gopCache_=[]),h.timelineStartInfo.dts=void 0,h.timelineStartInfo.pts=void 0,pt.clearDtsInfo(h),b.captionStream.reset()),b.timestampRolloverStream&&b.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(g){m&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(g)},this.setRemux=function(g){var b=this.transmuxPipeline_;l.remux=g,b&&b.coalesceStream&&b.coalesceStream.setRemux(g)},this.alignGopsWith=function(g){h&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(g)},this.getLogTrigger_=function(g){var b=this;return function(v){v.stream=g,b.trigger("log",v)}},this.push=function(g){if(f){var b=R0(g);b&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!b&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),f=!1}this.transmuxPipeline_.headOfPipeline.push(g)},this.flush=function(){f=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},an.prototype=new tn;var B0={Transmuxer:an},F0=function(l){return l>>>0},U0=function(l){return("00"+l.toString(16)).slice(-2)},on={toUnsigned:F0,toHexString:U0},q0=function(l){var d="";return d+=String.fromCharCode(l[0]),d+=String.fromCharCode(l[1]),d+=String.fromCharCode(l[2]),d+=String.fromCharCode(l[3]),d},Zu=q0,$0=on.toUnsigned,j0=Zu,ec=function(l,d){var f=[],h,m,g,b,v;if(!d.length)return null;for(h=0;h1?h+m:l.byteLength,g===d[0]&&(d.length===1?f.push(l.subarray(h+8,b)):(v=ec(l.subarray(h+8,b),d.slice(1)),v.length&&(f=f.concat(v)))),h=b;return f},Za=ec,H0=on.toUnsigned,V0=n.getUint64,z0=function(l){var d={version:l[0],flags:new Uint8Array(l.subarray(1,4))};return d.version===1?d.baseMediaDecodeTime=V0(l.subarray(4)):d.baseMediaDecodeTime=H0(l[4]<<24|l[5]<<16|l[6]<<8|l[7]),d},eo=z0,W0=function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),f={version:l[0],flags:new Uint8Array(l.subarray(1,4)),trackId:d.getUint32(4)},h=f.flags[2]&1,m=f.flags[2]&2,g=f.flags[2]&8,b=f.flags[2]&16,v=f.flags[2]&32,E=f.flags[0]&65536,w=f.flags[0]&131072,I;return I=8,h&&(I+=4,f.baseDataOffset=d.getUint32(12),I+=4),m&&(f.sampleDescriptionIndex=d.getUint32(I),I+=4),g&&(f.defaultSampleDuration=d.getUint32(I),I+=4),b&&(f.defaultSampleSize=d.getUint32(I),I+=4),v&&(f.defaultSampleFlags=d.getUint32(I)),E&&(f.durationIsEmpty=!0),!h&&w&&(f.baseDataOffsetIsMoof=!0),f},tc=W0,G0=function(l){return{isLeading:(l[0]&12)>>>2,dependsOn:l[0]&3,isDependedOn:(l[1]&192)>>>6,hasRedundancy:(l[1]&48)>>>4,paddingValue:(l[1]&14)>>>1,isNonSyncSample:l[1]&1,degradationPriority:l[2]<<8|l[3]}},X0=G0,ic=X0,K0=function(l){var d={version:l[0],flags:new Uint8Array(l.subarray(1,4)),samples:[]},f=new DataView(l.buffer,l.byteOffset,l.byteLength),h=d.flags[2]&1,m=d.flags[2]&4,g=d.flags[1]&1,b=d.flags[1]&2,v=d.flags[1]&4,E=d.flags[1]&8,w=f.getUint32(4),I=8,N;for(h&&(d.dataOffset=f.getInt32(I),I+=4),m&&w&&(N={flags:ic(l.subarray(I,I+4))},I+=4,g&&(N.duration=f.getUint32(I),I+=4),b&&(N.size=f.getUint32(I),I+=4),E&&(d.version===1?N.compositionTimeOffset=f.getInt32(I):N.compositionTimeOffset=f.getUint32(I),I+=4),d.samples.push(N),w--);w--;)N={},g&&(N.duration=f.getUint32(I),I+=4),b&&(N.size=f.getUint32(I),I+=4),v&&(N.flags=ic(l.subarray(I,I+4)),I+=4),E&&(d.version===1?N.compositionTimeOffset=f.getInt32(I):N.compositionTimeOffset=f.getUint32(I),I+=4),d.samples.push(N);return d},sc=K0,rc={tfdt:eo,trun:sc},nc={parseTfdt:rc.tfdt,parseTrun:rc.trun},Y0=function(l){for(var d=0,f=String.fromCharCode(l[d]),h="";f!=="\0";)h+=f,d++,f=String.fromCharCode(l[d]);return h+=f,h},Q0={uint8ToCString:Y0},ln=Q0.uint8ToCString,J0=n.getUint64,Z0=function(l){var d=4,f=l[0],h,m,g,b,v,E,w,I;if(f===0){h=ln(l.subarray(d)),d+=h.length,m=ln(l.subarray(d)),d+=m.length;var N=new DataView(l.buffer);g=N.getUint32(d),d+=4,v=N.getUint32(d),d+=4,E=N.getUint32(d),d+=4,w=N.getUint32(d),d+=4}else if(f===1){var N=new DataView(l.buffer);g=N.getUint32(d),d+=4,b=J0(l.subarray(d)),d+=8,E=N.getUint32(d),d+=4,w=N.getUint32(d),d+=4,h=ln(l.subarray(d)),d+=h.length,m=ln(l.subarray(d)),d+=m.length}I=new Uint8Array(l.subarray(d,l.byteLength));var H={scheme_id_uri:h,value:m,timescale:g||1,presentation_time:b,presentation_time_delta:v,event_duration:E,id:w,message_data:I};return ty(f,H)?H:void 0},ey=function(l,d,f,h){return l||l===0?l/d:h+f/d},ty=function(l,d){var f=d.scheme_id_uri!=="\0",h=l===0&&ac(d.presentation_time_delta)&&f,m=l===1&&ac(d.presentation_time)&&f;return!(l>1)&&h||m},ac=function(l){return l!==void 0||l!==null},iy={parseEmsgBox:Z0,scaleTime:ey},Us;typeof window<"u"?Us=window:typeof i<"u"?Us=i:typeof self<"u"?Us=self:Us={};var oc=Us,un=on.toUnsigned,qs=on.toHexString,xe=Za,qi=Zu,to=iy,sy=tc,ry=sc,ny=eo,ay=n.getUint64,lc,uc,cc,dc,hc,io,fc,so=oc,oy=Bu.parseId3Frames;lc=function(l){var d={},f=xe(l,["moov","trak"]);return f.reduce(function(h,m){var g,b,v,E,w;return g=xe(m,["tkhd"])[0],!g||(b=g[0],v=b===0?12:20,E=un(g[v]<<24|g[v+1]<<16|g[v+2]<<8|g[v+3]),w=xe(m,["mdia","mdhd"])[0],!w)?null:(b=w[0],v=b===0?12:20,h[E]=un(w[v]<<24|w[v+1]<<16|w[v+2]<<8|w[v+3]),h)},d)},uc=function(l,d){var f;f=xe(d,["moof","traf"]);var h=f.reduce(function(m,g){var b=xe(g,["tfhd"])[0],v=un(b[4]<<24|b[5]<<16|b[6]<<8|b[7]),E=l[v]||9e4,w=xe(g,["tfdt"])[0],I=new DataView(w.buffer,w.byteOffset,w.byteLength),N;w[0]===1?N=ay(w.subarray(4,12)):N=I.getUint32(4);let H;return typeof N=="bigint"?H=N/so.BigInt(E):typeof N=="number"&&!isNaN(N)&&(H=N/E),H11?(m.codec+=".",m.codec+=qs(U[9]),m.codec+=qs(U[10]),m.codec+=qs(U[11])):m.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(m.codec)?(U=H.subarray(28),W=qi(U.subarray(4,8)),W==="esds"&&U.length>20&&U[19]!==0?(m.codec+="."+qs(U[19]),m.codec+="."+qs(U[20]>>>2&63).replace(/^0/,"")):m.codec="mp4a.40.2"):m.codec=m.codec.toLowerCase())}var J=xe(h,["mdia","mdhd"])[0];J&&(m.timescale=io(J)),f.push(m)}),f},fc=function(l,d=0){var f=xe(l,["emsg"]);return f.map(h=>{var m=to.parseEmsgBox(new Uint8Array(h)),g=oy(m.message_data);return{cueTime:to.scaleTime(m.presentation_time,m.timescale,m.presentation_time_delta,d),duration:to.scaleTime(m.event_duration,m.timescale),frames:g}})};var $s={findBox:xe,parseType:qi,timescale:lc,startTime:uc,compositionStartTime:cc,videoTrackIds:dc,tracks:hc,getTimescaleFromMediaHeader:io,getEmsgID3:fc};const{parseTrun:ly}=nc,{findBox:pc}=$s;var mc=oc,uy=function(l){var d=pc(l,["moof","traf"]),f=pc(l,["mdat"]),h=[];return f.forEach(function(m,g){var b=d[g];h.push({mdat:m,traf:b})}),h},cy=function(l,d,f){var h=d,m=f.defaultSampleDuration||0,g=f.defaultSampleSize||0,b=f.trackId,v=[];return l.forEach(function(E){var w=ly(E),I=w.samples;I.forEach(function(N){N.duration===void 0&&(N.duration=m),N.size===void 0&&(N.size=g),N.trackId=b,N.dts=h,N.compositionTimeOffset===void 0&&(N.compositionTimeOffset=0),typeof h=="bigint"?(N.pts=h+mc.BigInt(N.compositionTimeOffset),h+=mc.BigInt(N.duration)):(N.pts=h+N.compositionTimeOffset,h+=N.duration)}),v=v.concat(I)}),v},gc={getMdatTrafPairs:uy,parseSamples:cy},dy=Ou.discardEmulationPreventionBytes,hy=Lu.CaptionStream,ro=Za,fy=eo,py=tc,{getMdatTrafPairs:my,parseSamples:gy}=gc,yy=function(l,d){for(var f=l,h=0;h0?fy(I[0]).baseMediaDecodeTime:0,H=ro(b,["trun"]),U,W;d===w&&H.length>0&&(U=gy(H,N,E),W=_y(g,U,w),f[w]||(f[w]={seiNals:[],logs:[]}),f[w].seiNals=f[w].seiNals.concat(W.seiNals),f[w].logs=f[w].logs.concat(W.logs))}),f},by=function(l,d,f){var h;if(d===null)return null;h=Ty(l,d);var m=h[d]||{};return{seiNals:m.seiNals,logs:m.logs,timescale:f}},vy=function(){var l=!1,d,f,h,m,g,b;this.isInitialized=function(){return l},this.init=function(v){d=new hy,l=!0,b=v?v.isPartial:!1,d.on("data",function(E){E.startTime=E.startPts/m,E.endTime=E.endPts/m,g.captions.push(E),g.captionStreams[E.stream]=!0}),d.on("log",function(E){g.logs.push(E)})},this.isNewInit=function(v,E){return v&&v.length===0||E&&typeof E=="object"&&Object.keys(E).length===0?!1:h!==v[0]||m!==E[h]},this.parse=function(v,E,w){var I;if(this.isInitialized()){if(!E||!w)return null;if(this.isNewInit(E,w))h=E[0],m=w[h];else if(h===null||!m)return f.push(v),null}else return null;for(;f.length>0;){var N=f.shift();this.parse(N,E,w)}return I=by(v,h,m),I&&I.logs&&(g.logs=g.logs.concat(I.logs)),I===null||!I.seiNals?g.logs.length?{logs:g.logs,captions:[],captionStreams:[]}:null:(this.pushNals(I.seiNals),this.flushStream(),g)},this.pushNals=function(v){if(!this.isInitialized()||!v||v.length===0)return null;v.forEach(function(E){d.push(E)})},this.flushStream=function(){if(!this.isInitialized())return null;b?d.partialFlush():d.flush()},this.clearParsedCaptions=function(){g.captions=[],g.captionStreams={},g.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;d.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){f=[],h=null,m=null,g?this.clearParsedCaptions():g={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},Sy=vy;const{parseTfdt:xy}=nc,Jt=Za,{getTimescaleFromMediaHeader:Ey}=$s,{parseSamples:Cy,getMdatTrafPairs:wy}=gc;var yc=function(){let l=9e4;this.init=function(d){const f=Jt(d,["moov","trak","mdia","mdhd"])[0];f&&(l=Ey(f))},this.parseSegment=function(d){const f=[],h=wy(d);let m=0;return h.forEach(function(g){const b=g.mdat,v=g.traf,E=Jt(v,["tfdt"])[0],w=Jt(v,["tfhd"])[0],I=Jt(v,["trun"]);if(E&&(m=xy(E).baseMediaDecodeTime),I.length&&w){const N=Cy(I,m,w);let H=0;N.forEach(function(U){const W="utf-8",J=new TextDecoder(W),De=b.slice(H,H+U.size);if(Jt(De,["vtte"])[0]){H+=U.size;return}Jt(De,["vttc"]).forEach(function(js){const Hs=Jt(js,["payl"])[0],Vs=Jt(js,["sttg"])[0],zs=U.pts/l,hn=(U.pts+U.duration)/l;let pe,Ws;if(Hs)try{pe=J.decode(Hs)}catch(mt){console.error(mt)}if(Vs)try{Ws=J.decode(Vs)}catch(mt){console.error(mt)}U.duration&&pe&&f.push({cueText:pe,start:zs,end:hn,settings:Ws})}),H+=U.size})}}),f}},no=zr,_c=function(l){var d=l[1]&31;return d<<=8,d|=l[2],d},cn=function(l){return!!(l[1]&64)},dn=function(l){var d=0;return(l[3]&48)>>>4>1&&(d+=l[4]+1),d},Ay=function(l,d){var f=_c(l);return f===0?"pat":f===d?"pmt":d?"pes":null},Dy=function(l){var d=cn(l),f=4+dn(l);return d&&(f+=l[f]+1),(l[f+10]&31)<<8|l[f+11]},ky=function(l){var d={},f=cn(l),h=4+dn(l);if(f&&(h+=l[h]+1),!!(l[h+5]&1)){var m,g,b;m=(l[h+1]&15)<<8|l[h+2],g=3+m-4,b=(l[h+10]&15)<<8|l[h+11];for(var v=12+b;v=l.byteLength)return null;var h=null,m;return m=l[f+7],m&192&&(h={},h.pts=(l[f+9]&14)<<27|(l[f+10]&255)<<20|(l[f+11]&254)<<12|(l[f+12]&255)<<5|(l[f+13]&254)>>>3,h.pts*=4,h.pts+=(l[f+13]&6)>>>1,h.dts=h.pts,m&64&&(h.dts=(l[f+14]&14)<<27|(l[f+15]&255)<<20|(l[f+16]&254)<<12|(l[f+17]&255)<<5|(l[f+18]&254)>>>3,h.dts*=4,h.dts+=(l[f+18]&6)>>>1)),h},ao=function(l){switch(l){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},Oy=function(l){for(var d=4+dn(l),f=l.subarray(d),h=0,m=0,g=!1,b;m3&&(b=ao(f[m+3]&31),b==="slice_layer_without_partitioning_rbsp_idr"&&(g=!0)),g},Ly={parseType:Ay,parsePat:Dy,parsePmt:ky,parsePayloadUnitStartIndicator:cn,parsePesType:Iy,parsePesTime:Py,videoPacketContainsKeyFrame:Oy},Tc=zr,$i=Nu.handleRollover,ae={};ae.ts=Ly,ae.aac=Ja;var bi=fe.ONE_SECOND_IN_TS,qe=188,St=71,Ry=function(l,d){for(var f=0,h=qe,m,g;h=0;){if(l[h]===St&&(l[m]===St||m===l.byteLength)){switch(g=l.subarray(h,m),b=ae.ts.parseType(g,d.pid),b){case"pes":v=ae.ts.parsePesType(g,d.table),E=ae.ts.parsePayloadUnitStartIndicator(g),v==="audio"&&E&&(w=ae.ts.parsePesTime(g),w&&(w.type="audio",f.audio.push(w),I=!0));break}if(I)break;h-=qe,m-=qe;continue}h--,m--}},Ny=function(l,d,f){for(var h=0,m=qe,g,b,v,E,w,I,N,H,U=!1,W={data:[],size:0};m=0;){if(l[h]===St&&l[m]===St){switch(g=l.subarray(h,m),b=ae.ts.parseType(g,d.pid),b){case"pes":v=ae.ts.parsePesType(g,d.table),E=ae.ts.parsePayloadUnitStartIndicator(g),v==="video"&&E&&(w=ae.ts.parsePesTime(g),w&&(w.type="video",f.video.push(w),U=!0));break}if(U)break;h-=qe,m-=qe;continue}h--,m--}},My=function(l,d){if(l.audio&&l.audio.length){var f=d;(typeof f>"u"||isNaN(f))&&(f=l.audio[0].dts),l.audio.forEach(function(g){g.dts=$i(g.dts,f),g.pts=$i(g.pts,f),g.dtsTime=g.dts/bi,g.ptsTime=g.pts/bi})}if(l.video&&l.video.length){var h=d;if((typeof h>"u"||isNaN(h))&&(h=l.video[0].dts),l.video.forEach(function(g){g.dts=$i(g.dts,h),g.pts=$i(g.pts,h),g.dtsTime=g.dts/bi,g.ptsTime=g.pts/bi}),l.firstKeyFrame){var m=l.firstKeyFrame;m.dts=$i(m.dts,h),m.pts=$i(m.pts,h),m.dtsTime=m.dts/bi,m.ptsTime=m.pts/bi}}},By=function(l){for(var d=!1,f=0,h=null,m=null,g=0,b=0,v;l.length-b>=3;){var E=ae.aac.parseType(l,b);switch(E){case"timed-metadata":if(l.length-b<10){d=!0;break}if(g=ae.aac.parseId3TagSize(l,b),g>l.length){d=!0;break}m===null&&(v=l.subarray(b,b+g),m=ae.aac.parseAacTimestamp(v)),b+=g;break;case"audio":if(l.length-b<7){d=!0;break}if(g=ae.aac.parseAdtsSize(l,b),g>l.length){d=!0;break}h===null&&(v=l.subarray(b,b+g),h=ae.aac.parseSampleRate(v)),f++,b+=g;break;default:b++;break}if(d)return null}if(h===null||m===null)return null;var w=bi/h,I={audio:[{type:"audio",dts:m,pts:m},{type:"audio",dts:m+f*1024*w,pts:m+f*1024*w}]};return I},Fy=function(l){var d={pid:null,table:null},f={};Ry(l,d);for(var h in d.table)if(d.table.hasOwnProperty(h)){var m=d.table[h];switch(m){case Tc.H264_STREAM_TYPE:f.video=[],Ny(l,d,f),f.video.length===0&&delete f.video;break;case Tc.ADTS_STREAM_TYPE:f.audio=[],bc(l,d,f),f.audio.length===0&&delete f.audio;break}}return f},Uy=function(l,d){var f=ae.aac.isLikelyAacData(l),h;return f?h=By(l):h=Fy(l),!h||!h.audio&&!h.video?null:(My(h,d),h)},qy={inspect:Uy,parseAudioPes_:bc};const $y=function(l,d){d.on("data",function(f){const h=f.initSegment;f.initSegment={data:h.buffer,byteOffset:h.byteOffset,byteLength:h.byteLength};const m=f.data;f.data=m.buffer,l.postMessage({action:"data",segment:f,byteOffset:m.byteOffset,byteLength:m.byteLength},[f.data])}),d.on("done",function(f){l.postMessage({action:"done"})}),d.on("gopInfo",function(f){l.postMessage({action:"gopInfo",gopInfo:f})}),d.on("videoSegmentTimingInfo",function(f){const h={start:{decode:fe.videoTsToSeconds(f.start.dts),presentation:fe.videoTsToSeconds(f.start.pts)},end:{decode:fe.videoTsToSeconds(f.end.dts),presentation:fe.videoTsToSeconds(f.end.pts)},baseMediaDecodeTime:fe.videoTsToSeconds(f.baseMediaDecodeTime)};f.prependedContentDuration&&(h.prependedContentDuration=fe.videoTsToSeconds(f.prependedContentDuration)),l.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:h})}),d.on("audioSegmentTimingInfo",function(f){const h={start:{decode:fe.videoTsToSeconds(f.start.dts),presentation:fe.videoTsToSeconds(f.start.pts)},end:{decode:fe.videoTsToSeconds(f.end.dts),presentation:fe.videoTsToSeconds(f.end.pts)},baseMediaDecodeTime:fe.videoTsToSeconds(f.baseMediaDecodeTime)};f.prependedContentDuration&&(h.prependedContentDuration=fe.videoTsToSeconds(f.prependedContentDuration)),l.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:h})}),d.on("id3Frame",function(f){l.postMessage({action:"id3Frame",id3Frame:f})}),d.on("caption",function(f){l.postMessage({action:"caption",caption:f})}),d.on("trackinfo",function(f){l.postMessage({action:"trackinfo",trackInfo:f})}),d.on("audioTimingInfo",function(f){l.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:fe.videoTsToSeconds(f.start),end:fe.videoTsToSeconds(f.end)}})}),d.on("videoTimingInfo",function(f){l.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:fe.videoTsToSeconds(f.start),end:fe.videoTsToSeconds(f.end)}})}),d.on("log",function(f){l.postMessage({action:"log",log:f})})};class vc{constructor(d,f){this.options=f||{},this.self=d,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new B0.Transmuxer(this.options),$y(this.self,this.transmuxer)}pushMp4Captions(d){this.captionParser||(this.captionParser=new Sy,this.captionParser.init());const f=new Uint8Array(d.data,d.byteOffset,d.byteLength),h=this.captionParser.parse(f,d.trackIds,d.timescales);this.self.postMessage({action:"mp4Captions",captions:h&&h.captions||[],logs:h&&h.logs||[],data:f.buffer},[f.buffer])}initMp4WebVttParser(d){this.webVttParser||(this.webVttParser=new yc);const f=new Uint8Array(d.data,d.byteOffset,d.byteLength);this.webVttParser.init(f)}getMp4WebVttText(d){this.webVttParser||(this.webVttParser=new yc);const f=new Uint8Array(d.data,d.byteOffset,d.byteLength),h=this.webVttParser.parseSegment(f);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:h||[],data:f.buffer},[f.buffer])}probeMp4StartTime({timescales:d,data:f}){const h=$s.startTime(d,f);this.self.postMessage({action:"probeMp4StartTime",startTime:h,data:f},[f.buffer])}probeMp4Tracks({data:d}){const f=$s.tracks(d);this.self.postMessage({action:"probeMp4Tracks",tracks:f,data:d},[d.buffer])}probeEmsgID3({data:d,offset:f}){const h=$s.getEmsgID3(d,f);this.self.postMessage({action:"probeEmsgID3",id3Frames:h,emsgData:d},[d.buffer])}probeTs({data:d,baseStartTime:f}){const h=typeof f=="number"&&!isNaN(f)?f*fe.ONE_SECOND_IN_TS:void 0,m=qy.inspect(d,h);let g=null;m&&(g={hasVideo:m.video&&m.video.length===2||!1,hasAudio:m.audio&&m.audio.length===2||!1},g.hasVideo&&(g.videoStart=m.video[0].ptsTime),g.hasAudio&&(g.audioStart=m.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:g,data:d},[d.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(d){const f=new Uint8Array(d.data,d.byteOffset,d.byteLength);this.transmuxer.push(f)}reset(){this.transmuxer.reset()}setTimestampOffset(d){const f=d.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(fe.secondsToVideoTs(f)))}setAudioAppendStart(d){this.transmuxer.setAudioAppendStart(Math.ceil(fe.secondsToVideoTs(d.appendStart)))}setRemux(d){this.transmuxer.setRemux(d.remux)}flush(d){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(d){this.transmuxer.alignGopsWith(d.gopsToAlignWith.slice())}}self.onmessage=function(l){if(l.data.action==="init"&&l.data.options){this.messageHandlers=new vc(self,l.data.options);return}this.messageHandlers||(this.messageHandlers=new vc(self)),l.data&&l.data.action&&l.data.action!=="init"&&this.messageHandlers[l.data.action]&&this.messageHandlers[l.data.action](l.data)}}));var mS=am(pS);const gS=(i,e,t)=>{const{type:s,initSegment:r,captions:n,captionStreams:a,metadata:o,videoFrameDtsTime:u,videoFramePtsTime:c}=i.data.segment;e.buffer.push({captions:n,captionStreams:a,metadata:o});const p=i.data.segment.boxes||{data:i.data.segment.data},y={type:s,data:new Uint8Array(p.data,p.data.byteOffset,p.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};typeof u<"u"&&(y.videoFrameDtsTime=u),typeof c<"u"&&(y.videoFramePtsTime=c),t(y)},yS=({transmuxedData:i,callback:e})=>{i.buffer=[],e(i)},_S=(i,e)=>{e.gopInfo=i.data.gopInfo},um=i=>{const{transmuxer:e,bytes:t,audioAppendStart:s,gopsToAlignWith:r,remux:n,onData:a,onTrackInfo:o,onAudioTimingInfo:u,onVideoTimingInfo:c,onVideoSegmentTimingInfo:p,onAudioSegmentTimingInfo:y,onId3:T,onCaptions:x,onDone:S,onEndedTimeline:_,onTransmuxerLog:A,isEndOfTimeline:D,segment:P,triggerSegmentEventFn:k}=i,O={buffer:[]};let R=D;const q=$=>{e.currentTransmux===i&&($.data.action==="data"&&gS($,O,a),$.data.action==="trackinfo"&&o($.data.trackInfo),$.data.action==="gopInfo"&&_S($,O),$.data.action==="audioTimingInfo"&&u($.data.audioTimingInfo),$.data.action==="videoTimingInfo"&&c($.data.videoTimingInfo),$.data.action==="videoSegmentTimingInfo"&&p($.data.videoSegmentTimingInfo),$.data.action==="audioSegmentTimingInfo"&&y($.data.audioSegmentTimingInfo),$.data.action==="id3Frame"&&T([$.data.id3Frame],$.data.id3Frame.dispatchType),$.data.action==="caption"&&x($.data.caption),$.data.action==="endedtimeline"&&(R=!1,_()),$.data.action==="log"&&A($.data.log),$.data.type==="transmuxed"&&(R||(e.onmessage=null,yS({transmuxedData:O,callback:S}),cm(e))))},F=()=>{const $={message:"Received an error message from the transmuxer worker",metadata:{errorType:L.Error.StreamingFailedToTransmuxSegment,segmentInfo:xi({segment:P})}};S(null,$)};if(e.onmessage=q,e.onerror=F,s&&e.postMessage({action:"setAudioAppendStart",appendStart:s}),Array.isArray(r)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),typeof n<"u"&&e.postMessage({action:"setRemux",remux:n}),t.byteLength){const $=t instanceof ArrayBuffer?t:t.buffer,X=t instanceof ArrayBuffer?0:t.byteOffset;k({type:"segmenttransmuxingstart",segment:P}),e.postMessage({action:"push",data:$,byteOffset:X,byteLength:t.byteLength},[$])}D&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},cm=i=>{i.currentTransmux=null,i.transmuxQueue.length&&(i.currentTransmux=i.transmuxQueue.shift(),typeof i.currentTransmux=="function"?i.currentTransmux():um(i.currentTransmux))},Nd=(i,e)=>{i.postMessage({action:e}),cm(i)},dm=(i,e)=>{if(!e.currentTransmux){e.currentTransmux=i,Nd(e,i);return}e.transmuxQueue.push(Nd.bind(null,e,i))},TS=i=>{dm("reset",i)},bS=i=>{dm("endTimeline",i)},hm=i=>{if(!i.transmuxer.currentTransmux){i.transmuxer.currentTransmux=i,um(i);return}i.transmuxer.transmuxQueue.push(i)},vS=i=>{const e=new mS;e.currentTransmux=null,e.transmuxQueue=[];const t=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,t.call(e)),e.postMessage({action:"init",options:i}),e};var Do={reset:TS,endTimeline:bS,transmux:hm,createTransmuxer:vS};const rs=function(i){const e=i.transmuxer,t=i.endAction||i.action,s=i.callback,r=ve({},i,{endAction:null,transmuxer:null,callback:null}),n=a=>{a.data.action===t&&(e.removeEventListener("message",n),a.data.data&&(a.data.data=new Uint8Array(a.data.data,i.byteOffset||0,i.byteLength||a.data.data.byteLength),i.data&&(i.data=a.data.data)),s(a.data))};if(e.addEventListener("message",n),i.data){const a=i.data instanceof ArrayBuffer;r.byteOffset=a?0:i.data.byteOffset,r.byteLength=i.data.byteLength;const o=[a?i.data:i.data.buffer];e.postMessage(r,o)}else e.postMessage(r)},It={FAILURE:2,TIMEOUT:-101,ABORTED:-102},fm="wvtt",nl=i=>{i.forEach(e=>{e.abort()})},SS=i=>({bandwidth:i.bandwidth,bytesReceived:i.bytesReceived||0,roundTripTime:i.roundTripTime||0}),xS=i=>{const e=i.target,s={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return s.bytesReceived=i.loaded,s.bandwidth=Math.floor(s.bytesReceived/s.roundTripTime*8*1e3),s},yu=(i,e)=>{const{requestType:t}=e,s=Oi({requestType:t,request:e,error:i});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:It.TIMEOUT,xhr:e,metadata:s}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:It.ABORTED,xhr:e,metadata:s}:i?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:It.FAILURE,xhr:e,metadata:s}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:It.FAILURE,xhr:e,metadata:s}:null},Md=(i,e,t,s)=>(r,n)=>{const a=n.response,o=yu(r,n);if(o)return t(o,i);if(a.byteLength!==16)return t({status:n.status,message:"Invalid HLS key at URL: "+n.uri,code:It.FAILURE,xhr:n},i);const u=new DataView(a),c=new Uint32Array([u.getUint32(0),u.getUint32(4),u.getUint32(8),u.getUint32(12)]);for(let y=0;y{e===fm&&i.transmuxer.postMessage({action:"initMp4WebVttParser",data:i.map.bytes})},CS=(i,e,t)=>{e===fm&&rs({action:"getMp4WebVttText",data:i.bytes,transmuxer:i.transmuxer,callback:({data:s,mp4VttCues:r})=>{i.bytes=s,t(null,i,{mp4VttCues:r})}})},pm=(i,e)=>{const t=ql(i.map.bytes);if(t!=="mp4"){const s=i.map.resolvedUri||i.map.uri,r=t||"unknown";return e({internal:!0,message:`Found unsupported ${r} container for initialization segment at URL: ${s}`,code:It.FAILURE,metadata:{mediaType:r}})}rs({action:"probeMp4Tracks",data:i.map.bytes,transmuxer:i.transmuxer,callback:({tracks:s,data:r})=>(i.map.bytes=r,s.forEach(function(n){i.map.tracks=i.map.tracks||{},!i.map.tracks[n.type]&&(i.map.tracks[n.type]=n,typeof n.id=="number"&&n.timescale&&(i.map.timescales=i.map.timescales||{},i.map.timescales[n.id]=n.timescale),n.type==="text"&&ES(i,n.codec))}),e(null))})},wS=({segment:i,finishProcessingFn:e,triggerSegmentEventFn:t})=>(s,r)=>{const n=yu(s,r);if(n)return e(n,i);const a=new Uint8Array(r.response);if(t({type:"segmentloaded",segment:i}),i.map.key)return i.map.encryptedBytes=a,e(null,i);i.map.bytes=a,pm(i,function(o){if(o)return o.xhr=r,o.status=r.status,e(o,i);e(null,i)})},AS=({segment:i,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:s})=>(r,n)=>{const a=yu(r,n);if(a)return e(a,i);s({type:"segmentloaded",segment:i});const o=t==="arraybuffer"||!n.responseText?n.response:hS(n.responseText.substring(i.lastReachedChar||0));return i.stats=SS(n),i.key?i.encryptedBytes=new Uint8Array(o):i.bytes=new Uint8Array(o),e(null,i)},DS=({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:y,onTransmuxerLog:T,triggerSegmentEventFn:x})=>{const S=i.map&&i.map.tracks||{},_=!!(S.audio&&S.video);let A=s.bind(null,i,"audio","start");const D=s.bind(null,i,"audio","end");let P=s.bind(null,i,"video","start");const k=s.bind(null,i,"video","end"),O=()=>hm({bytes:e,transmuxer:i.transmuxer,audioAppendStart:i.audioAppendStart,gopsToAlignWith:i.gopsToAlignWith,remux:_,onData:R=>{R.type=R.type==="combined"?"video":R.type,p(i,R)},onTrackInfo:R=>{t&&(_&&(R.isMuxed=!0),t(i,R))},onAudioTimingInfo:R=>{A&&typeof R.start<"u"&&(A(R.start),A=null),D&&typeof R.end<"u"&&D(R.end)},onVideoTimingInfo:R=>{P&&typeof R.start<"u"&&(P(R.start),P=null),k&&typeof R.end<"u"&&k(R.end)},onVideoSegmentTimingInfo:R=>{const q={pts:{start:R.start.presentation,end:R.end.presentation},dts:{start:R.start.decode,end:R.end.decode}};x({type:"segmenttransmuxingtiminginfoavailable",segment:i,timingInfo:q}),r(R)},onAudioSegmentTimingInfo:R=>{const q={pts:{start:R.start.pts,end:R.end.pts},dts:{start:R.start.dts,end:R.end.dts}};x({type:"segmenttransmuxingtiminginfoavailable",segment:i,timingInfo:q}),n(R)},onId3:(R,q)=>{a(i,R,q)},onCaptions:R=>{o(i,[R])},isEndOfTimeline:u,onEndedTimeline:()=>{c()},onTransmuxerLog:T,onDone:(R,q)=>{y&&(R.type=R.type==="combined"?"video":R.type,x({type:"segmenttransmuxingcomplete",segment:i}),y(q,i,R))},segment:i,triggerSegmentEventFn:x});rs({action:"probeTs",transmuxer:i.transmuxer,data:e,baseStartTime:i.baseStartTime,callback:R=>{i.bytes=e=R.data;const q=R.result;q&&(t(i,{hasAudio:q.hasAudio,hasVideo:q.hasVideo,isMuxed:_}),t=null),O()}})},mm=({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:y,onTransmuxerLog:T,triggerSegmentEventFn:x})=>{let S=new Uint8Array(e);if(Yb(S)){i.isFmp4=!0;const{tracks:_}=i.map;if(_.text&&(!_.audio||!_.video)){p(i,{data:S,type:"text"}),CS(i,_.text.codec,y);return}const D={isFmp4:!0,hasVideo:!!_.video,hasAudio:!!_.audio};_.audio&&_.audio.codec&&_.audio.codec!=="enca"&&(D.audioCodec=_.audio.codec),_.video&&_.video.codec&&_.video.codec!=="encv"&&(D.videoCodec=_.video.codec),_.video&&_.audio&&(D.isMuxed=!0),t(i,D);const P=(k,O)=>{p(i,{data:S,type:D.hasAudio&&!D.isMuxed?"audio":"video"}),O&&O.length&&a(i,O),k&&k.length&&o(i,k),y(null,i,{})};rs({action:"probeMp4StartTime",timescales:i.map.timescales,data:S,transmuxer:i.transmuxer,callback:({data:k,startTime:O})=>{e=k.buffer,i.bytes=S=k,D.hasAudio&&!D.isMuxed&&s(i,"audio","start",O),D.hasVideo&&s(i,"video","start",O),rs({action:"probeEmsgID3",data:S,transmuxer:i.transmuxer,offset:O,callback:({emsgData:R,id3Frames:q})=>{if(e=R.buffer,i.bytes=S=R,!_.video||!R.byteLength||!i.transmuxer){P(void 0,q);return}rs({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:i.transmuxer,data:S,timescales:i.map.timescales,trackIds:[_.video.id],callback:F=>{e=F.data.buffer,i.bytes=S=F.data,F.logs.forEach(function($){T(re($,{stream:"mp4CaptionParser"}))}),P(F.captions,q)}})}})}});return}if(!i.transmuxer){y(null,i,{});return}if(typeof i.container>"u"&&(i.container=ql(S)),i.container!=="ts"&&i.container!=="aac"){t(i,{hasAudio:!1,hasVideo:!1}),y(null,i,{});return}DS({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:y,onTransmuxerLog:T,triggerSegmentEventFn:x})},gm=function({id:i,key:e,encryptedBytes:t,decryptionWorker:s,segment:r,doneFn:n},a){const o=c=>{if(c.data.source===i){s.removeEventListener("message",o);const p=c.data.decrypted;a(new Uint8Array(p.bytes,p.byteOffset,p.byteLength))}};s.onerror=()=>{const c="An error occurred in the decryption worker",p=xi({segment:r}),y={message:c,metadata:{error:new Error(c),errorType:L.Error.StreamingFailedToDecryptSegment,segmentInfo:p,keyInfo:{uri:r.key.resolvedUri||r.map.key.resolvedUri}}};n(y,r)},s.addEventListener("message",o);let u;e.bytes.slice?u=e.bytes.slice():u=new Uint32Array(Array.prototype.slice.call(e.bytes)),s.postMessage(em({source:i,encrypted:t,key:u,iv:e.iv}),[t.buffer,u.buffer])},kS=({decryptionWorker:i,segment:e,trackInfoFn:t,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:y,onTransmuxerLog:T,triggerSegmentEventFn:x})=>{x({type:"segmentdecryptionstart"}),gm({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:i,segment:e,doneFn:y},S=>{e.bytes=S,x({type:"segmentdecryptioncomplete",segment:e}),mm({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:y,onTransmuxerLog:T,triggerSegmentEventFn:x})})},IS=({activeXhrs:i,decryptionWorker:e,trackInfoFn:t,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:y,onTransmuxerLog:T,triggerSegmentEventFn:x})=>{let S=0,_=!1;return(A,D)=>{if(!_){if(A)return _=!0,nl(i),y(A,D);if(S+=1,S===i.length){const P=function(){if(D.encryptedBytes)return kS({decryptionWorker:e,segment:D,trackInfoFn:t,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:y,onTransmuxerLog:T,triggerSegmentEventFn:x});mm({segment:D,bytes:D.bytes,trackInfoFn:t,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:y,onTransmuxerLog:T,triggerSegmentEventFn:x})};if(D.endOfAllRequests=Date.now(),D.map&&D.map.encryptedBytes&&!D.map.bytes)return x({type:"segmentdecryptionstart",segment:D}),gm({decryptionWorker:e,id:D.requestId+"-init",encryptedBytes:D.map.encryptedBytes,key:D.map.key,segment:D,doneFn:y},k=>{D.map.bytes=k,x({type:"segmentdecryptioncomplete",segment:D}),pm(D,O=>{if(O)return nl(i),y(O,D);P()})});P()}}}},PS=({loadendState:i,abortFn:e})=>t=>{t.target.aborted&&e&&!i.calledAbortFn&&(e(),i.calledAbortFn=!0)},OS=({segment:i,progressFn:e,trackInfoFn:t,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p})=>y=>{if(!y.target.aborted)return i.stats=re(i.stats,xS(y)),!i.stats.firstBytesReceivedAt&&i.stats.bytesReceived&&(i.stats.firstBytesReceivedAt=Date.now()),e(y,i)},LS=({xhr:i,xhrOptions:e,decryptionWorker:t,segment:s,abortFn:r,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:c,id3Fn:p,captionsFn:y,isEndOfTimeline:T,endedTimelineFn:x,dataFn:S,doneFn:_,onTransmuxerLog:A,triggerSegmentEventFn:D})=>{const P=[],k=IS({activeXhrs:P,decryptionWorker:t,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:c,id3Fn:p,captionsFn:y,isEndOfTimeline:T,endedTimelineFn:x,dataFn:S,doneFn:_,onTransmuxerLog:A,triggerSegmentEventFn:D});if(s.key&&!s.key.bytes){const $=[s.key];s.map&&!s.map.bytes&&s.map.key&&s.map.key.resolvedUri===s.key.resolvedUri&&$.push(s.map.key);const X=re(e,{uri:s.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),le=Md(s,$,k,D),ee={uri:s.key.resolvedUri};D({type:"segmentkeyloadstart",segment:s,keyInfo:ee});const ce=i(X,le);P.push(ce)}if(s.map&&!s.map.bytes){if(s.map.key&&(!s.key||s.key.resolvedUri!==s.map.key.resolvedUri)){const ce=re(e,{uri:s.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),z=Md(s,[s.map.key],k,D),te={uri:s.map.key.resolvedUri};D({type:"segmentkeyloadstart",segment:s,keyInfo:te});const Ue=i(ce,z);P.push(Ue)}const X=re(e,{uri:s.map.resolvedUri,responseType:"arraybuffer",headers:sl(s.map),requestType:"segment-media-initialization"}),le=wS({segment:s,finishProcessingFn:k,triggerSegmentEventFn:D});D({type:"segmentloadstart",segment:s});const ee=i(X,le);P.push(ee)}const O=re(e,{uri:s.part&&s.part.resolvedUri||s.resolvedUri,responseType:"arraybuffer",headers:sl(s),requestType:"segment"}),R=AS({segment:s,finishProcessingFn:k,responseType:O.responseType,triggerSegmentEventFn:D});D({type:"segmentloadstart",segment:s});const q=i(O,R);q.addEventListener("progress",OS({segment:s,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:c,id3Fn:p,captionsFn:y,isEndOfTimeline:T,endedTimelineFn:x,dataFn:S})),P.push(q);const F={};return P.forEach($=>{$.addEventListener("loadend",PS({loadendState:F,abortFn:r}))}),()=>nl(P)},_n=ht("PlaylistSelector"),Bd=function(i){if(!i||!i.playlist)return;const e=i.playlist;return JSON.stringify({id:e.id,bandwidth:i.bandwidth,width:i.width,height:i.height,codecs:e.attributes&&e.attributes.CODECS||""})},ns=function(i,e){if(!i)return"";const t=C.getComputedStyle(i);return t?t[e]:""},as=function(i,e){const t=i.slice();i.sort(function(s,r){const n=e(s,r);return n===0?t.indexOf(s)-t.indexOf(r):n})},_u=function(i,e){let t,s;return i.attributes.BANDWIDTH&&(t=i.attributes.BANDWIDTH),t=t||C.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(s=e.attributes.BANDWIDTH),s=s||C.Number.MAX_VALUE,t-s},RS=function(i,e){let t,s;return i.attributes.RESOLUTION&&i.attributes.RESOLUTION.width&&(t=i.attributes.RESOLUTION.width),t=t||C.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(s=e.attributes.RESOLUTION.width),s=s||C.Number.MAX_VALUE,t===s&&i.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?i.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-s};let ym=function(i){const{main:e,bandwidth:t,playerWidth:s,playerHeight:r,playerObjectFit:n,limitRenditionByPlayerDimensions:a,playlistController:o}=i;if(!e)return;const u={bandwidth:t,width:s,height:r,limitRenditionByPlayerDimensions:a};let c=e.playlists;Ye.isAudioOnly(e)&&(c=o.getAudioTrackPlaylists_(),u.audioOnly=!0);let p=c.map(F=>{let $;const X=F.attributes&&F.attributes.RESOLUTION&&F.attributes.RESOLUTION.width,le=F.attributes&&F.attributes.RESOLUTION&&F.attributes.RESOLUTION.height;return $=F.attributes&&F.attributes.BANDWIDTH,$=$||C.Number.MAX_VALUE,{bandwidth:$,width:X,height:le,playlist:F}});as(p,(F,$)=>F.bandwidth-$.bandwidth),p=p.filter(F=>!Ye.isIncompatible(F.playlist));let y=p.filter(F=>Ye.isEnabled(F.playlist));y.length||(y=p.filter(F=>!Ye.isDisabled(F.playlist)));const T=y.filter(F=>F.bandwidth*ke.BANDWIDTH_VARIANCEF.bandwidth===x.bandwidth)[0];if(a===!1){const F=S||y[0]||p[0];if(F&&F.playlist){let $="sortedPlaylistReps";return S&&($="bandwidthBestRep"),y[0]&&($="enabledPlaylistReps"),_n(`choosing ${Bd(F)} using ${$} with options`,u),F.playlist}return _n("could not choose a playlist with options",u),null}const _=T.filter(F=>F.width&&F.height);as(_,(F,$)=>F.width-$.width);const A=_.filter(F=>F.width===s&&F.height===r);x=A[A.length-1];const D=A.filter(F=>F.bandwidth===x.bandwidth)[0];let P,k,O;D||(P=_.filter(F=>n==="cover"?F.width>s&&F.height>r:F.width>s||F.height>r),k=P.filter(F=>F.width===P[0].width&&F.height===P[0].height),x=k[k.length-1],O=k.filter(F=>F.bandwidth===x.bandwidth)[0]);let R;if(o.leastPixelDiffSelector){const F=_.map($=>($.pixelDiff=Math.abs($.width-s)+Math.abs($.height-r),$));as(F,($,X)=>$.pixelDiff===X.pixelDiff?X.bandwidth-$.bandwidth:$.pixelDiff-X.pixelDiff),R=F[0]}const q=R||O||D||S||y[0]||p[0];if(q&&q.playlist){let F="sortedPlaylistReps";return R?F="leastPixelDiffRep":O?F="resolutionPlusOneRep":D?F="resolutionBestRep":S?F="bandwidthBestRep":y[0]&&(F="enabledPlaylistReps"),_n(`choosing ${Bd(q)} using ${F} with options`,u),q.playlist}return _n("could not choose a playlist with options",u),null};const Fd=function(){let i=this.useDevicePixelRatio&&C.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(i=this.customPixelRatio),ym({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(ns(this.tech_.el(),"width"),10)*i,playerHeight:parseInt(ns(this.tech_.el(),"height"),10)*i,playerObjectFit:this.usePlayerObjectFit?ns(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},NS=function(i){let e=-1,t=-1;if(i<0||i>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let s=this.useDevicePixelRatio&&C.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(s=this.customPixelRatio),e<0&&(e=this.systemBandwidth,t=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==t&&(e=i*this.systemBandwidth+(1-i)*e,t=this.systemBandwidth),ym({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(ns(this.tech_.el(),"width"),10)*s,playerHeight:parseInt(ns(this.tech_.el(),"height"),10)*s,playerObjectFit:this.usePlayerObjectFit?ns(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},MS=function(i){const{main:e,currentTime:t,bandwidth:s,duration:r,segmentDuration:n,timeUntilRebuffer:a,currentTimeline:o,syncController:u}=i,c=e.playlists.filter(S=>!Ye.isIncompatible(S));let p=c.filter(Ye.isEnabled);p.length||(p=c.filter(S=>!Ye.isDisabled(S)));const T=p.filter(Ye.hasAttribute.bind(null,"BANDWIDTH")).map(S=>{const A=u.getSyncPoint(S,r,o,t)?1:2,P=Ye.estimateSegmentRequestTime(n,s,S)*A-a;return{playlist:S,rebufferingImpact:P}}),x=T.filter(S=>S.rebufferingImpact<=0);return as(x,(S,_)=>_u(_.playlist,S.playlist)),x.length?x[0]:(as(T,(S,_)=>S.rebufferingImpact-_.rebufferingImpact),T[0]||null)},BS=function(){const i=this.playlists.main.playlists.filter(Ye.isEnabled);return as(i,(t,s)=>_u(t,s)),i.filter(t=>!!fr(this.playlists.main,t).video)[0]||null},FS=i=>{let e=0,t;return i.bytes&&(t=new Uint8Array(i.bytes),i.segments.forEach(s=>{t.set(s,e),e+=s.byteLength})),t};function _m(i){try{return new URL(i).pathname.split("/").slice(-2).join("/")}catch{return""}}const US=function(i,e,t){if(!i[t]){e.trigger({type:"usage",name:"vhs-608"});let s=t;/^cc708_/.test(t)&&(s="SERVICE"+t.split("_")[1]);const r=e.textTracks().getTrackById(s);if(r)i[t]=r;else{const n=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=t,o=t,u=!1;const c=n[s];c&&(a=c.label,o=c.language,u=c.default),i[t]=e.addRemoteTextTrack({kind:"captions",id:s,default:u,label:a,language:o},!1).track}}},qS=function({inbandTextTracks:i,captionArray:e,timestampOffset:t}){if(!e)return;const s=C.WebKitDataCue||C.VTTCue;e.forEach(r=>{const n=r.stream;r.content?r.content.forEach(a=>{const o=new s(r.startTime+t,r.endTime+t,a.text);o.line=a.line,o.align="left",o.position=a.position,o.positionAlign="line-left",i[n].addCue(o)}):i[n].addCue(new s(r.startTime+t,r.endTime+t,r.text))})},$S=function(i){Object.defineProperties(i.frame,{id:{get(){return L.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),i.value.key}},value:{get(){return L.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),i.value.data}},privateData:{get(){return L.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),i.value.data}}})},jS=({inbandTextTracks:i,metadataArray:e,timestampOffset:t,videoDuration:s})=>{if(!e)return;const r=C.WebKitDataCue||C.VTTCue,n=i.metadataTrack_;if(!n||(e.forEach(p=>{const y=p.cueTime+t;typeof y!="number"||C.isNaN(y)||y<0||!(y<1/0)||!p.frames||!p.frames.length||p.frames.forEach(T=>{const x=new r(y,y,T.value||T.url||T.data||"");x.frame=T,x.value=T,$S(x),n.addCue(x)})}),!n.cues||!n.cues.length))return;const a=n.cues,o=[];for(let p=0;p{const T=p[y.startTime]||[];return T.push(y),p[y.startTime]=T,p},{}),c=Object.keys(u).sort((p,y)=>Number(p)-Number(y));c.forEach((p,y)=>{const T=u[p],x=isFinite(s)?s:p,S=Number(c[y+1])||x;T.forEach(_=>{_.endTime=S})})},HS={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},VS=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),zS=({inbandTextTracks:i,dateRanges:e})=>{const t=i.metadataTrack_;if(!t)return;const s=C.WebKitDataCue||C.VTTCue;e.forEach(r=>{for(const n of Object.keys(r)){if(VS.has(n))continue;const a=new s(r.startTime,r.endTime,"");a.id=r.id,a.type="com.apple.quicktime.HLS",a.value={key:HS[n],data:r[n]},(n==="scte35Out"||n==="scte35In")&&(a.value.data=new Uint8Array(a.value.data.match(/[\da-f]{2}/gi)).buffer),t.addCue(a)}r.processDateRange()})},Ud=(i,e,t)=>{i.metadataTrack_||(i.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,L.browser.IS_ANY_SAFARI||(i.metadataTrack_.inBandMetadataTrackDispatchType=e))},ar=function(i,e,t){let s,r;if(t&&t.cues)for(s=t.cues.length;s--;)r=t.cues[s],r.startTime>=i&&r.endTime<=e&&t.removeCue(r)},WS=function(i){const e=i.cues;if(!e)return;const t={};for(let s=e.length-1;s>=0;s--){const r=e[s],n=`${r.startTime}-${r.endTime}-${r.text}`;t[n]?i.removeCue(r):t[n]=r}},GS=(i,e,t)=>{if(typeof e>"u"||e===null||!i.length)return[];const s=Math.ceil((e-t+3)*Ei.ONE_SECOND_IN_TS);let r;for(r=0;rs);r++);return i.slice(r)},XS=(i,e,t)=>{if(!e.length)return i;if(t)return e.slice();const s=e[0].pts;let r=0;for(r;r=s);r++);return i.slice(0,r).concat(e)},KS=(i,e,t,s)=>{const r=Math.ceil((e-s)*Ei.ONE_SECOND_IN_TS),n=Math.ceil((t-s)*Ei.ONE_SECOND_IN_TS),a=i.slice();let o=i.length;for(;o--&&!(i[o].pts<=n););if(o===-1)return a;let u=o+1;for(;u--&&!(i[u].pts<=r););return u=Math.max(u,0),a.splice(u,o-u+1),a},YS=function(i,e){if(!i&&!e||!i&&e||i&&!e)return!1;if(i===e)return!0;const t=Object.keys(i).sort(),s=Object.keys(e).sort();if(t.length!==s.length)return!1;for(let r=0;rt))return n}return s.length===0?0:s[s.length-1]},Zs=1,JS=500,qd=i=>typeof i=="number"&&isFinite(i),Tn=1/60,ZS=(i,e,t)=>i!=="main"||!e||!t?null:!t.hasAudio&&!t.hasVideo?"Neither audio nor video found in segment.":e.hasVideo&&!t.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!e.hasVideo&&t.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null,e1=(i,e,t)=>{let s=e-ke.BACK_BUFFER_LENGTH;i.length&&(s=Math.max(s,i.start(0)));const r=e-t;return Math.min(r,s)},Xi=i=>{const{startOfSegment:e,duration:t,segment:s,part:r,playlist:{mediaSequence:n,id:a,segments:o=[]},mediaIndex:u,partIndex:c,timeline:p}=i,y=o.length-1;let T="mediaIndex/partIndex increment";i.getMediaInfoForTime?T=`getMediaInfoForTime (${i.getMediaInfoForTime})`:i.isSyncRequest&&(T="getSyncSegmentCandidate (isSyncRequest)"),i.independent&&(T+=` with independent ${i.independent}`);const x=typeof c=="number",S=i.segment.uri?"segment":"pre-segment",_=x?Mp({preloadSegment:s})-1:0;return`${S} [${n+u}/${n+y}]`+(x?` part [${c}/${_}]`:"")+` segment start/end [${s.start} => ${s.end}]`+(x?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${p}] selected by [${T}] playlist [${a}]`},$d=i=>`${i}TimingInfo`,t1=({segmentTimeline:i,currentTimeline:e,startOfSegment:t,buffered:s,overrideCheck:r})=>!r&&i===e?null:i{if(e===t)return!1;if(s==="audio"){const n=i.lastTimelineChange({type:"main"});return!n||n.to!==t}if(s==="main"&&r){const n=i.pendingTimelineChange({type:"audio"});return!(n&&n.to===t)}return!1},i1=i=>{if(!i)return!1;const e=i.pendingTimelineChange({type:"audio"}),t=i.pendingTimelineChange({type:"main"}),s=e&&t,r=s&&e.to!==t.to;return!!(s&&e.from!==-1&&t.from!==-1&&r)},s1=i=>{const e=i.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=i.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to{const e=i.pendingSegment_;if(!e)return;if(al({timelineChangeController:i.timelineChangeController_,currentTimeline:i.currentTimeline_,segmentTimeline:e.timeline,loaderType:i.loaderType_,audioDisabled:i.audioDisabled_})&&i1(i.timelineChangeController_)){if(s1(i)){i.timelineChangeController_.trigger("audioTimelineBehind");return}i.timelineChangeController_.trigger("fixBadTimelineChange")}},r1=i=>{let e=0;return["video","audio"].forEach(function(t){const s=i[`${t}TimingInfo`];if(!s)return;const{start:r,end:n}=s;let a;typeof r=="bigint"||typeof n=="bigint"?a=C.BigInt(n)-C.BigInt(r):typeof r=="number"&&typeof n=="number"&&(a=n-r),typeof a<"u"&&a>e&&(e=a)}),typeof e=="bigint"&&ei?Math.round(i)>e+Dt:!1,n1=(i,e)=>{if(e!=="hls")return null;const t=r1({audioTimingInfo:i.audioTimingInfo,videoTimingInfo:i.videoTimingInfo});if(!t)return null;const s=i.playlist.targetDuration,r=jd({segmentDuration:t,maxDuration:s*2}),n=jd({segmentDuration:t,maxDuration:s}),a=`Segment with index ${i.mediaIndex} from playlist ${i.playlist.id} has a duration of ${t} when the reported duration is ${i.duration} and the target duration is ${s}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;return r||n?{severity:r?"warn":"info",message:a}:null},xi=({type:i,segment:e})=>{if(!e)return;const t=!!(e.key||e.map&&e.map.ke),s=!!(e.map&&!e.map.bytes),r=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:i||e.type,uri:e.resolvedUri||e.uri,start:r,duration:e.duration,isEncrypted:t,isMediaInitialization:s}};class ol extends L.EventTarget{constructor(e,t={}){if(super(),!e)throw new TypeError("Initialization settings are required");if(typeof e.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.logger_=ht(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(s){s!==this.state_&&(this.logger_(`${this.state_} -> ${s}`),this.state_=s,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():si(this)}),this.sourceUpdater_.on("codecschange",s=>{this.trigger(ve({type:"codecschange"},s))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():si(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",s=>{this.trigger(ve({type:"timelinechange"},s)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():si(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():si(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return Do.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&C.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){if(this.state!=="WAITING"){this.pendingSegment_&&(this.pendingSegment_=null),this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);return}this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,C.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return this.state==="APPENDING"&&!this.pendingSegment_?(this.state="READY",!0):!this.pendingSegment_||this.pendingSegment_.requestId!==e}error(e){return typeof e<"u"&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&Do.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return Pe();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:s,isMuxed:r}=e;if(s&&t&&!this.audioDisabled_&&!r)return this.sourceUpdater_.buffered();if(s)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const s=Jn(e);let r=this.initSegments_[s];return t&&!r&&e.bytes&&(this.initSegments_[s]=r={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),r||e}segmentKey(e,t=!1){if(!e)return null;const s=tm(e);let r=this.keyCache_[s];this.cacheEncryptionKeys_&&t&&!r&&e.bytes&&(this.keyCache_[s]=r={resolvedUri:e.resolvedUri,bytes:e.bytes});const n={resolvedUri:(r||e).resolvedUri};return r&&(n.bytes=r.bytes),n}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!!this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e||this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;const s=this.playlist_,r=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));let n=null;if(s&&(s.id?n=s.id:s.uri&&(n=s.uri)),this.logger_(`playlist update [${n} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update: currentTime: ${this.currentTime_()} bufferedEnd: ${wo(this.buffered_())} `,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!s||s.uri!==e.uri){this.mediaIndex!==null&&(!e.endList&&typeof e.partTargetDuration=="number"?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}const a=e.mediaSequence-s.mediaSequence;if(this.logger_(`live window shift [${a}]`),this.mediaIndex!==null)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const o=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!o.parts||!o.parts.length||!o.parts[this.partIndex])){const u=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=u}}r&&(r.mediaIndex-=a,r.mediaIndex<0?(r.mediaIndex=null,r.partIndex=null):(r.mediaIndex>=0&&(r.segment=e.segments[r.mediaIndex]),r.partIndex>=0&&r.segment.parts&&(r.part=r.segment.parts[r.partIndex]))),this.syncController_.saveExpiredSegmentInfo(s,e)}pause(){this.checkBufferTimeout_&&(C.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return this.checkBufferTimeout_===null}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}resyncLoader(){this.transmuxer_&&Do.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;const e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;this.sourceType_==="hls"&&!e&&(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,s=()=>{},r=!1){if(t===1/0&&(t=this.duration_()),t<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}let n=1;const a=()=>{n--,n===0&&s()};(r||!this.audioDisabled_)&&(n++,this.sourceUpdater_.removeAudio(e,t,a)),(r||this.loaderType_==="main")&&(this.gopBuffer_=KS(this.gopBuffer_,e,t,this.timeMapping_),n++,this.sourceUpdater_.removeVideo(e,t,a));for(const o in this.inbandTextTracks_)ar(e,t,this.inbandTextTracks_[o]);ar(e,t,this.segmentMetadataTrack_),a()}monitorBuffer_(){this.checkBufferTimeout_&&C.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=C.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&C.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=C.setTimeout(this.monitorBufferTick_.bind(this),JS)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const t={segmentInfo:xi({type:this.loaderType_,segment:e})};this.trigger({type:"segmentselected",metadata:t}),typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e)}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,s=this.partIndex){if(!t||!this.mediaSource_)return!1;const r=typeof e=="number"&&t.segments[e],n=e+1===t.segments.length,a=!r||!r.parts||s+1===r.parts.length;return t.endList&&this.mediaSource_.readyState==="open"&&n&&a}chooseNextRequest_(){const e=this.buffered_(),t=wo(e)||0,s=fu(e,this.currentTime_()),r=!this.hasPlayed_()&&s>=1,n=s>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||r||n)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);const o={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:!this.syncPoint_};if(o.isSyncRequest)o.mediaIndex=QS(this.currentTimeline_,a,t),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${o.mediaIndex}`);else if(this.mediaIndex!==null){const T=a[this.mediaIndex],x=typeof this.partIndex=="number"?this.partIndex:-1;o.startOfSegment=T.end?T.end:t,T.parts&&T.parts[x+1]?(o.mediaIndex=this.mediaIndex,o.partIndex=x+1):o.mediaIndex=this.mediaIndex+1}else{let T,x,S;const _=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch: For TargetTime: ${_}. CurrentTime: ${this.currentTime_()} BufferedEnd: ${t} Fetch At Buffer: ${this.fetchAtBuffer_} `,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const A=this.getSyncInfoFromMediaSequenceSync_(_);if(!A){const D="No sync info found while using media sequence sync";return this.error({message:D,metadata:{errorType:L.Error.StreamingFailedToSelectNextSegment,error:new Error(D)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${A.start} --> ${A.end})`),T=A.segmentIndex,x=A.partIndex,S=A.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const A=Ye.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:_,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});T=A.segmentIndex,x=A.partIndex,S=A.startTime}o.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${_}`:`currentTime ${_}`,o.mediaIndex=T,o.startOfSegment=S,o.partIndex=x,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${o.mediaIndex} `)}const u=a[o.mediaIndex];let c=u&&typeof o.partIndex=="number"&&u.parts&&u.parts[o.partIndex];if(!u||typeof o.partIndex=="number"&&!c)return null;typeof o.partIndex!="number"&&u.parts&&(o.partIndex=0,c=u.parts[0]);const p=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!s&&c&&!p&&!c.independent)if(o.partIndex===0){const T=a[o.mediaIndex-1],x=T.parts&&T.parts.length&&T.parts[T.parts.length-1];x&&x.independent&&(o.mediaIndex-=1,o.partIndex=T.parts.length-1,o.independent="previous segment")}else u.parts[o.partIndex-1].independent&&(o.partIndex-=1,o.independent="previous part");const y=this.mediaSource_&&this.mediaSource_.readyState==="ended";return o.mediaIndex>=a.length-1&&y&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,o.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(o))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;const t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${t}`);const s=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!s)return null;if(!s.isAppended)return s;const r=this.mediaSequenceSync_.getSyncInfoForTime(s.end);return r?(r.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),r):null}generateSegmentInfo_(e){const{independent:t,playlist:s,mediaIndex:r,startOfSegment:n,isSyncRequest:a,partIndex:o,forceTimestampOffset:u,getMediaInfoForTime:c}=e,p=s.segments[r],y=typeof o=="number"&&p.parts[o],T={requestId:"segment-loader-"+Math.random(),uri:y&&y.resolvedUri||p.resolvedUri,mediaIndex:r,partIndex:y?o:null,isSyncRequest:a,startOfSegment:n,playlist:s,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:p.timeline,duration:y&&y.duration||p.duration,segment:p,part:y,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:c,independent:t},x=typeof u<"u"?u:this.isPendingTimestampOffset_;T.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:p.timeline,currentTimeline:this.currentTimeline_,startOfSegment:n,buffered:this.buffered_(),overrideCheck:x});const S=wo(this.sourceUpdater_.audioBuffered());return typeof S=="number"&&(T.audioAppendStart=S-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(T.gopsToAlignWith=GS(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),T}timestampOffsetForSegment_(e){return t1(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const t=this.currentTime_(),s=e.bandwidth,r=this.pendingSegment_.duration,n=Ye.estimateSegmentRequestTime(r,s,this.playlist_,e.bytesReceived),a=x2(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(n<=a)return;const o=MS({main:this.vhs_.playlists.main,currentTime:t,bandwidth:s,duration:this.duration_(),segmentDuration:r,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!o)return;const c=n-a-o.rebufferingImpact;let p=.5;a<=Dt&&(p=1),!(!o.playlist||o.playlist.uri===this.playlist_.uri||c{n[a.stream]=n[a.stream]||{startTime:1/0,captions:[],endTime:0};const o=n[a.stream];o.startTime=Math.min(o.startTime,a.startTime+r),o.endTime=Math.max(o.endTime,a.endTime+r),o.captions.push(a)}),Object.keys(n).forEach(a=>{const{startTime:o,endTime:u,captions:c}=n[a],p=this.inbandTextTracks_;this.logger_(`adding cues from ${o} -> ${u} for ${a}`),US(p,this.vhs_.tech_,a),ar(o,u,p[a]),qS({captionArray:c,inbandTextTracks:p,timestampOffset:r})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,s){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,s));return}this.addMetadataToTextTrack(s,t,this.duration_())}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach(t=>t())}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach(t=>t())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;const e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!al({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}):!0:!1}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready()||this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:s,hasVideo:r,isMuxed:n}=t;return!(r&&!e.videoTimingInfo||s&&!this.audioDisabled_&&!n&&!e.audioTimingInfo||al({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){si(this),this.callQueue_.push(this.handleData_.bind(this,e,t));return}const s=this.pendingSegment_;if(this.setTimeMapping_(s.timeline),this.updateMediaSecondsLoaded_(s.part||s.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),s.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),s.isFmp4=e.isFmp4,s.timingInfo=s.timingInfo||{},s.isFmp4)this.trigger("fmp4"),s.timingInfo.start=s[$d(t.type)].start;else{const r=this.getCurrentMediaInfo_(),n=this.loaderType_==="main"&&r&&r.hasVideo;let a;n&&(a=s.videoTimingInfo.start),s.timingInfo.start=this.trueSegmentStart_({currentStart:s.timingInfo.start,playlist:s.playlist,mediaIndex:s.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:n,firstVideoFrameTimeForData:a,videoTimingInfo:s.videoTimingInfo,audioTimingInfo:s.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(s,t.type),this.updateSourceBufferTimestampOffset_(s),s.isSyncRequest){this.updateTimingInfoEnd_(s),this.syncController_.saveSegmentTimingInfo({segmentInfo:s,shouldSaveTimelineMapping:this.loaderType_==="main"});const r=this.chooseNextRequest_();if(r.mediaIndex!==s.mediaIndex||r.partIndex!==s.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}s.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(s,t)}}updateAppendInitSegmentStatus(e,t){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:s,playlist:r}){if(s){const n=Jn(s);if(this.activeInitSegmentId_===n)return null;t=this.initSegmentForMap(s,!0).bytes,this.activeInitSegmentId_=n}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=r,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:s},r){const n=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();n.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+Ci(n).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+Ci(a).join(", "));const o=n.length?n.start(0):0,u=n.length?n.end(n.length-1):0,c=a.length?a.start(0):0,p=a.length?a.end(a.length-1):0;if(u-o<=Zs&&p-c<=Zs){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${s.byteLength}, audio buffer: ${Ci(n).join(", ")}, video buffer: ${Ci(a).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:s}));const T=this.currentTime_()-Zs;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${T}`),this.remove(0,T,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${Zs}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=C.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},Zs*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:s},r){if(r){if(r.code===Gp){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:s});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",r),this.error({message:`${t} append of ${s.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:L.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:s,data:r,bytes:n}){if(!n){const o=[r];let u=r.byteLength;s&&(o.unshift(s),u+=s.byteLength),n=FS({bytes:u,segments:o})}const a={segmentInfo:xi({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:a}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:n},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:n}))}handleSegmentTimingInfo_(e,t,s){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const r=this.pendingSegment_.segment,n=`${e}TimingInfo`;r[n]||(r[n]={}),r[n].transmuxerPrependedSeconds=s.prependedContentDuration||0,r[n].transmuxedPresentationStart=s.start.presentation,r[n].transmuxedDecodeStart=s.start.decode,r[n].transmuxedPresentationEnd=s.end.presentation,r[n].transmuxedDecodeEnd=s.end.decode,r[n].baseMediaDecodeTime=s.baseMediaDecodeTime}appendData_(e,t){const{type:s,data:r}=t;if(!r||!r.byteLength||s==="audio"&&this.audioDisabled_)return;const n=this.getInitSegmentAndUpdateState_({type:s,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:s,initSegment:n,data:r})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),typeof e.timestampOffset=="number"&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){si(this),this.loadQueue_.push(()=>{const t=ve({},e,{forceTimestampOffset:!0});ve(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),s=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=this.mediaIndex!==null,n=e.timeline!==this.currentTimeline_&&e.timeline>0,a=s||r&&n;this.logger_(`Requesting ${_m(e.uri)} ${Xi(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=LS({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:o,level:u,stream:c})=>{this.logger_(`${Xi(e)} logged from transmuxer stream ${c} as a ${u}: ${o}`)},triggerSegmentEventFn:({type:o,segment:u,keyInfo:c,trackInfo:p,timingInfo:y})=>{const x={segmentInfo:xi({segment:u})};c&&(x.keyInfo=c),p&&(x.trackInfo=p),y&&(x.timingInfo=y),this.trigger({type:o,metadata:x})}})}trimBackBuffer_(e){const t=e1(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,s=e.part,r=e.segment.key||e.segment.map&&e.segment.map.key,n=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:s?s.resolvedUri:t.resolvedUri,byterange:s?s.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:r,isMediaInitialization:n},o=e.playlist.segments[e.mediaIndex-1];if(o&&o.timeline===t.timeline&&(o.videoTimingInfo?a.baseStartTime=o.videoTimingInfo.transmuxedDecodeEnd:o.audioTimingInfo&&(a.baseStartTime=o.audioTimingInfo.transmuxedDecodeEnd)),t.key){const u=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);a.key=this.segmentKey(t.key),a.key.iv=u}return t.map&&(a.map=this.initSegmentForMap(t.map)),a}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e"u"||c.end!==r+n?r:o.start}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:s,hasVideo:r,isMuxed:n}=t,a=this.loaderType_==="main"&&r,o=!this.audioDisabled_&&s&&!n;if(e.waitingOnAppends=0,!e.hasAppendedData_){!e.timingInfo&&typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e);return}a&&e.waitingOnAppends++,o&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),o&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,e.waitingOnAppends===0&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=ZS(this.loaderType_,this.getCurrentMediaInfo_(),e);return t?(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0):!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:s}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:s.start:s.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),r=this.loaderType_==="main"&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;r&&(e.timingInfo.end=typeof r.end=="number"?r.end:r.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const u={segmentInfo:xi({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:u})}if(!this.pendingSegment_){this.state="READY",this.paused()||this.monitorBuffer_();return}const e=this.pendingSegment_;e.part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:this.loaderType_==="main"});const t=n1(e,this.sourceType_);if(t&&(t.severity==="warn"?L.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)){this.logger_(`Throwing away un-appended sync request ${Xi(e)}`);return}this.logger_(`Appended ${Xi(e)}`),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),this.loaderType_==="main"&&!this.audioDisabled_&&this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const s=e.segment,r=e.part,n=s.end&&this.currentTime_()-s.end>e.playlist.targetDuration*3,a=r&&r.end&&this.currentTime_()-r.end>e.playlist.partTargetDuration*3;if(n||a){this.logger_(`bad ${n?"segment":"part"} ${Xi(e)}`),this.resetEverything();return}this.mediaIndex!==null&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duratione.toUpperCase())},a1=["video","audio"],ll=(i,e)=>{const t=e[`${i}Buffer`];return t&&t.updating||e.queuePending[i]},o1=(i,e)=>{for(let t=0;t{if(e.queue.length===0)return;let t=0,s=e.queue[t];if(s.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),s.action(e),s.doneFn&&s.doneFn(),os("audio",e),os("video",e));return}if(i!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||ll(i,e))){if(s.type!==i){if(t=o1(i,e.queue),t===null)return;s=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[i]=s,s.action(i,e),!s.doneFn){e.queuePending[i]=null,os(i,e);return}}},bm=(i,e)=>{const t=e[`${i}Buffer`],s=Tm(i);t&&(t.removeEventListener("updateend",e[`on${s}UpdateEnd_`]),t.removeEventListener("error",e[`on${s}Error_`]),e.codecs[i]=null,e[`${i}Buffer`]=null)},wt=(i,e)=>i&&e&&Array.prototype.indexOf.call(i.sourceBuffers,e)!==-1,st={appendBuffer:(i,e,t)=>(s,r)=>{const n=r[`${s}Buffer`];if(wt(r.mediaSource,n)){r.logger_(`Appending segment ${e.mediaIndex}'s ${i.length} bytes to ${s}Buffer`);try{n.appendBuffer(i)}catch(a){r.logger_(`Error with code ${a.code} `+(a.code===Gp?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${s}Buffer`),r.queuePending[s]=null,t(a)}}},remove:(i,e)=>(t,s)=>{const r=s[`${t}Buffer`];if(wt(s.mediaSource,r)){s.logger_(`Removing ${i} to ${e} from ${t}Buffer`);try{r.remove(i,e)}catch{s.logger_(`Remove ${i} to ${e} from ${t}Buffer failed`)}}},timestampOffset:i=>(e,t)=>{const s=t[`${e}Buffer`];wt(t.mediaSource,s)&&(t.logger_(`Setting ${e}timestampOffset to ${i}`),s.timestampOffset=i)},callback:i=>(e,t)=>{i()},endOfStream:i=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${i||""})`);try{e.mediaSource.endOfStream(i)}catch(t){L.log.warn("Failed to call media source endOfStream",t)}}},duration:i=>e=>{e.logger_(`Setting mediaSource duration to ${i}`);try{e.mediaSource.duration=i}catch(t){L.log.warn("Failed to set media source duration",t)}},abort:()=>(i,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${i}Buffer`];if(wt(e.mediaSource,t)){e.logger_(`calling abort on ${i}Buffer`);try{t.abort()}catch(s){L.log.warn(`Failed to abort on ${i}Buffer`,s)}}},addSourceBuffer:(i,e)=>t=>{const s=Tm(i),r=us(e);t.logger_(`Adding ${i}Buffer with codec ${e} to mediaSource`);const n=t.mediaSource.addSourceBuffer(r);n.addEventListener("updateend",t[`on${s}UpdateEnd_`]),n.addEventListener("error",t[`on${s}Error_`]),t.codecs[i]=e,t[`${i}Buffer`]=n},removeSourceBuffer:i=>e=>{const t=e[`${i}Buffer`];if(bm(i,e),!!wt(e.mediaSource,t)){e.logger_(`Removing ${i}Buffer with codec ${e.codecs[i]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(s){L.log.warn(`Failed to removeSourceBuffer ${i}Buffer`,s)}}},changeType:i=>(e,t)=>{const s=t[`${e}Buffer`],r=us(i);if(!wt(t.mediaSource,s))return;const n=i.substring(0,i.indexOf(".")),a=t.codecs[e];if(a.substring(0,a.indexOf("."))===n)return;const u={codecsChangeInfo:{from:a,to:i}};t.trigger({type:"codecschange",metadata:u}),t.logger_(`changing ${e}Buffer codec from ${a} to ${i}`);try{s.changeType(r),t.codecs[e]=i}catch(c){u.errorType=L.Error.StreamingCodecsChangeError,u.error=c,c.metadata=u,t.error_=c,t.trigger("error"),L.log.warn(`Failed to changeType on ${e}Buffer`,c)}}},rt=({type:i,sourceUpdater:e,action:t,doneFn:s,name:r})=>{e.queue.push({type:i,action:t,doneFn:s,name:r}),os(i,e)},Hd=(i,e)=>t=>{const s=e[`${i}Buffered`](),r=b2(s);if(e.logger_(`received "updateend" event for ${i} Source Buffer: `,r),e.queuePending[i]){const n=e.queuePending[i].doneFn;e.queuePending[i]=null,n&&n(e[`${i}Error_`])}os(i,e)};class vm extends L.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>os("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=ht("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=Hd("video",this),this.onAudioUpdateEnd_=Hd("audio",this),this.onVideoError_=t=>{this.videoError_=t},this.onAudioError_=t=>{this.audioError_=t},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){rt({type:"mediaSource",sourceUpdater:this,action:st.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){rt({type:e,sourceUpdater:this,action:st.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){L.log.error("removeSourceBuffer is not supported!");return}rt({type:"mediaSource",sourceUpdater:this,action:st.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!L.browser.IS_FIREFOX&&C.MediaSource&&C.MediaSource.prototype&&typeof C.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return C.SourceBuffer&&C.SourceBuffer.prototype&&typeof C.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){L.log.error("changeType is not supported!");return}rt({type:e,sourceUpdater:this,action:st.changeType(t),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!="object"||Object.keys(e).length===0)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(t=>{const s=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,s);this.canChangeType()&&this.changeType(t,s)})}appendBuffer(e,t){const{segmentInfo:s,type:r,bytes:n}=e;if(this.processedAppend_=!0,r==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${n.length} until video append`);return}const a=t;if(rt({type:r,sourceUpdater:this,action:st.appendBuffer(n,s||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),r==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const o=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${o.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,o.forEach(u=>{this.appendBuffer.apply(this,u)})}}audioBuffered(){return wt(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:Pe()}videoBuffered(){return wt(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:Pe()}buffered(){const e=wt(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=wt(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():S2(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=jt){rt({type:"mediaSource",sourceUpdater:this,action:st.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=jt){typeof e!="string"&&(e=void 0),rt({type:"mediaSource",sourceUpdater:this,action:st.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,s=jt){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){s();return}rt({type:"audio",sourceUpdater:this,action:st.remove(e,t),doneFn:s,name:"remove"})}removeVideo(e,t,s=jt){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){s();return}rt({type:"video",sourceUpdater:this,action:st.remove(e,t),doneFn:s,name:"remove"})}updating(){return!!(ll("audio",this)||ll("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(rt({type:"audio",sourceUpdater:this,action:st.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(rt({type:"video",sourceUpdater:this,action:st.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&rt({type:"audio",sourceUpdater:this,action:st.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&rt({type:"video",sourceUpdater:this,action:st.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),a1.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>bm(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const Vd=i=>decodeURIComponent(escape(String.fromCharCode.apply(null,i))),l1=i=>{const e=new Uint8Array(i);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},zd=new Uint8Array(` `.split("").map(i=>i.charCodeAt(0)));class u1 extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class c1 extends ol{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return Pe();const e=this.subtitlesTrack_.cues,t=e[0].startTime,s=e[e.length-1].startTime;return Pe([[t,s]])}initSegmentForMap(e,t=!1){if(!e)return null;const s=Jn(e);let r=this.initSegments_[s];if(t&&!r&&e.bytes){const n=zd.byteLength+e.bytes.byteLength,a=new Uint8Array(n);a.set(e.bytes),a.set(zd,e.bytes.byteLength),this.initSegments_[s]=r={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return r||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return typeof e>"u"?this.subtitlesTrack_:(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(e,t){ar(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const t=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",t),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,s){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===It.TIMEOUT&&this.handleTimeout_(),e.code===It.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const r=this.pendingSegment_,n=s.mp4VttCues&&s.mp4VttCues.length;n&&(r.mp4VttCues=s.mp4VttCues),this.saveBandwidthRelatedStats_(r.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const a=r.segment;if(a.map&&(a.map.bytes=t.map.bytes),r.bytes=t.bytes,typeof C.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,s),()=>this.stopForError({message:"Error loading vtt.js"}));return}a.requested=!0;try{this.parseVTTCues_(r)}catch(o){this.stopForError({message:o.message,metadata:{errorType:L.Error.StreamingVttParserError,error:o}});return}if(n||this.updateTimeMapping_(r,this.syncController_.timelines[r.timeline],this.playlist_),r.cues.length?r.timingInfo={start:r.cues[0].startTime,end:r.cues[r.cues.length-1].endTime}:r.timingInfo={start:r.startOfSegment,end:r.startOfSegment+r.duration},r.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}r.byteLength=r.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,r.cues.forEach(o=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new C.VTTCue(o.startTime,o.endTime,o.text):o)}),WS(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,t){const s=e&&e.type==="vtt",r=t&&t.type==="text";s&&r&&super.handleData_(e,t)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){const t=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(s=>{const r=s.start+t,n=s.end+t,a=new C.VTTCue(r,n,s.cueText);s.settings&&s.settings.split(" ").forEach(o=>{const u=o.split(":"),c=u[0],p=u[1];a[c]=isNaN(p)?p:Number(p)}),e.cues.push(a)})}parseVTTCues_(e){let t,s=!1;if(typeof C.WebVTT!="function")throw new u1;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof C.TextDecoder=="function"?t=new C.TextDecoder("utf8"):(t=C.WebVTT.StringDecoder(),s=!0);const r=new C.WebVTT.Parser(C,C.vttjs,t);if(r.oncue=e.cues.push.bind(e.cues),r.ontimestampmap=a=>{e.timestampmap=a},r.onparsingerror=a=>{L.log.warn("Error encountered when parsing cues: "+a.message)},e.segment.map){let a=e.segment.map.bytes;s&&(a=Vd(a)),r.parse(a)}let n=e.bytes;s&&(n=Vd(n)),r.parse(n),r.flush()}updateTimeMapping_(e,t,s){const r=e.segment;if(!t)return;if(!e.cues.length){r.empty=!0;return}const{MPEGTS:n,LOCAL:a}=e.timestampmap,u=n/Ei.ONE_SECOND_IN_TS-a+t.mapping;if(e.cues.forEach(c=>{const p=c.endTime-c.startTime,y=this.handleRollover_(c.startTime+u,t.time);c.startTime=Math.max(y,0),c.endTime=Math.max(y+p,0)}),!s.syncInfo){const c=e.cues[0].startTime,p=e.cues[e.cues.length-1].startTime;s.syncInfo={mediaSequence:s.mediaSequence+e.mediaIndex,time:Math.min(c,p-r.duration)}}}handleRollover_(e,t){if(t===null)return e;let s=e*Ei.ONE_SECOND_IN_TS;const r=t*Ei.ONE_SECOND_IN_TS;let n;for(r4294967296;)s+=n;return s/Ei.ONE_SECOND_IN_TS}}const d1=function(i,e){const t=i.cues;for(let s=0;s=r.adStartTime&&e<=r.adEndTime)return r}return null},h1=function(i,e,t=0){if(!i.segments)return;let s=t,r;for(let n=0;n=this.start&&e0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class Sm{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(e=>e.resetAppendStatus())}update(e,t){const{mediaSequence:s,segments:r}=e;if(this.isReliable_=this.isReliablePlaylist_(s,r),!!this.isReliable_)return this.updateStorage_(r,s,this.calculateBaseTime_(s,r,t))}getSyncInfoForTime(e){for(const{segmentSyncInfo:t,partsSyncInfo:s}of this.storage_.values())if(s.length){for(const r of s)if(r.isInRange(e))return r}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,s){const r=new Map;let n=` `,a=s,o=t;this.start_=a,e.forEach((u,c)=>{const p=this.storage_.get(o),y=a,T=y+u.duration,x=!!(p&&p.segmentSyncInfo&&p.segmentSyncInfo.isAppended),S=new Wd({start:y,end:T,appended:x,segmentIndex:c});u.syncInfo=S;let _=a;const A=(u.parts||[]).map((D,P)=>{const k=_,O=_+D.duration,R=!!(p&&p.partsSyncInfo&&p.partsSyncInfo[P]&&p.partsSyncInfo[P].isAppended),q=new Wd({start:k,end:O,appended:R,segmentIndex:c,partIndex:P});return _=O,n+=`Media Sequence: ${o}.${P} | Range: ${k} --> ${O} | Appended: ${R} `,D.syncInfo=q,q});r.set(o,new f1(S,A)),n+=`${_m(u.resolvedUri)} | Media Sequence: ${o} | Range: ${y} --> ${T} | Appended: ${x} `,o++,a=T}),this.end_=a,this.storage_=r,this.diagnostics_=n}calculateBaseTime_(e,t,s){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const r=Math.min(...this.storage_.keys());if(et!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(i,e,t,s,r,n)=>{const a=i.getMediaSequenceSync(n);if(!a||!a.isReliable)return null;const o=a.getSyncInfoForTime(r);return o?{time:o.start,partIndex:o.partIndex,segmentIndex:o.segmentIndex}:null}},{name:"ProgramDateTime",run:(i,e,t,s,r)=>{if(!Object.keys(i.timelineToDatetimeMappings).length)return null;let n=null,a=null;const o=Jo(e);r=r||0;for(let u=0;u{let n=null,a=null;r=r||0;const o=Jo(e);for(let u=0;u=x)&&(a=x,n={time:T,segmentIndex:p.segmentIndex,partIndex:p.partIndex})}}return n}},{name:"Discontinuity",run:(i,e,t,s,r)=>{let n=null;if(r=r||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let o=0;o=y)&&(a=y,n={time:p.time,segmentIndex:u,partIndex:null})}}}return n}},{name:"Playlist",run:(i,e,t,s,r)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class m1 extends L.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new Sm,s=new Gd(t),r=new Gd(t);this.mediaSequenceStorage_={main:t,audio:s,vtt:r},this.logger_=ht("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,s,r,n){if(t!==1/0)return ko.find(({name:u})=>u==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,s,r,n);if(!a.length)return null;for(const o of a){const{syncPoint:u,strategy:c}=o,{segmentIndex:p,time:y}=u;if(p<0)continue;const T=e.segments[p],x=y,S=x+T.duration;if(this.logger_(`Strategy: ${c}. Current time: ${r}. selected segment: ${p}. Time: [${x} -> ${S}]}`),r>=x&&r0&&(r.time*=-1),Math.abs(r.time+hr({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:r.segmentIndex,endIndex:0}))}runStrategies_(e,t,s,r,n){const a=[];for(let o=0;op1){L.log.warn(`Not saving expired segment info. Media sequence gap ${s} is too large.`);return}for(let r=s-1;r>=0;r--){const n=e.segments[r];if(n&&typeof n.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+r,time:n.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],s=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-s}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const s=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),r=e.segment;s&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:r.start}));const n=r.dateTimeObject;r.discontinuity&&t&&n&&(this.timelineToDatetimeMappings[r.timeline]=-(n.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,s){const r=e.segment,n=e.part;let a=this.timelines[e.timeline],o,u;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},s&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),o=e.startOfSegment,u=t.end+a.mapping;else if(a)o=t.start+a.mapping,u=t.end+a.mapping;else return!1;return n&&(n.start=o,n.end=u),(!r.start||ou){let c;o<0?c=s.start-hr({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:n}):c=s.end+hr({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:n}),this.discontinuities[a]={time:c,accuracy:u}}}}dispose(){this.trigger("dispose"),this.off()}}class g1 extends L.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:s}){return typeof t=="number"&&typeof s=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:s},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:s}){if(typeof t=="number"&&typeof s=="number"){this.lastTimelineChanges_[e]={type:e,from:t,to:s},delete this.pendingTimelineChanges_[e];const r={timelineChangeInfo:{from:t,to:s}};this.trigger({type:"timelinechange",metadata:r})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const y1=om(lm(function(){var i=function(){function _(){this.listeners={}}var A=_.prototype;return A.on=function(P,k){this.listeners[P]||(this.listeners[P]=[]),this.listeners[P].push(k)},A.off=function(P,k){if(!this.listeners[P])return!1;var O=this.listeners[P].indexOf(k);return this.listeners[P]=this.listeners[P].slice(0),this.listeners[P].splice(O,1),O>-1},A.trigger=function(P){var k=this.listeners[P];if(k)if(arguments.length===2)for(var O=k.length,R=0;R>7)*283)^O]=O;for(R=q=0;!P[R];R^=X||1,q=$[q]||1)for(ce=q^q<<1^q<<2^q<<3^q<<4,ce=ce>>8^ce&255^99,P[R]=ce,k[ce]=R,ee=F[le=F[X=F[R]]],te=ee*16843009^le*65537^X*257^R*16843008,z=F[ce]*257^ce*16843008,O=0;O<4;O++)A[O][R]=z=z<<24^z>>>8,D[O][ce]=te=te<<24^te>>>8;for(O=0;O<5;O++)A[O]=A[O].slice(0),D[O]=D[O].slice(0);return _};let s=null;class r{constructor(A){s||(s=t()),this._tables=[[s[0][0].slice(),s[0][1].slice(),s[0][2].slice(),s[0][3].slice(),s[0][4].slice()],[s[1][0].slice(),s[1][1].slice(),s[1][2].slice(),s[1][3].slice(),s[1][4].slice()]];let D,P,k;const O=this._tables[0][4],R=this._tables[1],q=A.length;let F=1;if(q!==4&&q!==6&&q!==8)throw new Error("Invalid aes key size");const $=A.slice(0),X=[];for(this._key=[$,X],D=q;D<4*q+28;D++)k=$[D-1],(D%q===0||q===8&&D%q===4)&&(k=O[k>>>24]<<24^O[k>>16&255]<<16^O[k>>8&255]<<8^O[k&255],D%q===0&&(k=k<<8^k>>>24^F<<24,F=F<<1^(F>>7)*283)),$[D]=$[D-q]^k;for(P=0;D;P++,D--)k=$[P&3?D:D-4],D<=4||P<4?X[P]=k:X[P]=R[0][O[k>>>24]]^R[1][O[k>>16&255]]^R[2][O[k>>8&255]]^R[3][O[k&255]]}decrypt(A,D,P,k,O,R){const q=this._key[1];let F=A^q[0],$=k^q[1],X=P^q[2],le=D^q[3],ee,ce,z;const te=q.length/4-2;let Ue,ie=4;const Se=this._tables[1],Bt=Se[0],pi=Se[1],mi=Se[2],gi=Se[3],yi=Se[4];for(Ue=0;Ue>>24]^pi[$>>16&255]^mi[X>>8&255]^gi[le&255]^q[ie],ce=Bt[$>>>24]^pi[X>>16&255]^mi[le>>8&255]^gi[F&255]^q[ie+1],z=Bt[X>>>24]^pi[le>>16&255]^mi[F>>8&255]^gi[$&255]^q[ie+2],le=Bt[le>>>24]^pi[F>>16&255]^mi[$>>8&255]^gi[X&255]^q[ie+3],ie+=4,F=ee,$=ce,X=z;for(Ue=0;Ue<4;Ue++)O[(3&-Ue)+R]=yi[F>>>24]<<24^yi[$>>16&255]<<16^yi[X>>8&255]<<8^yi[le&255]^q[ie++],ee=F,F=$,$=X,X=le,le=ee}}class n extends i{constructor(){super(i),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(A){this.jobs.push(A),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(_){return _<<24|(_&65280)<<8|(_&16711680)>>8|_>>>24},o=function(_,A,D){const P=new Int32Array(_.buffer,_.byteOffset,_.byteLength>>2),k=new r(Array.prototype.slice.call(A)),O=new Uint8Array(_.byteLength),R=new Int32Array(O.buffer);let q,F,$,X,le,ee,ce,z,te;for(q=D[0],F=D[1],$=D[2],X=D[3],te=0;te{const P=_[D];T(P)?A[D]={bytes:P.buffer,byteOffset:P.byteOffset,byteLength:P.byteLength}:A[D]=P}),A};self.onmessage=function(_){const A=_.data,D=new Uint8Array(A.encrypted.bytes,A.encrypted.byteOffset,A.encrypted.byteLength),P=new Uint32Array(A.key.bytes,A.key.byteOffset,A.key.byteLength/4),k=new Uint32Array(A.iv.bytes,A.iv.byteOffset,A.iv.byteLength/4);new u(D,P,k,function(O,R){self.postMessage(S({source:A.source,decrypted:R}),[R.buffer])})}}));var _1=am(y1);const T1=i=>{let e=i.default?"main":"alternative";return i.characteristics&&i.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},xm=(i,e)=>{i.abort(),i.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},ul=(i,e)=>{e.activePlaylistLoader=i,i.load()},b1=(i,e)=>()=>{const{segmentLoaders:{[i]:t,main:s},mediaTypes:{[i]:r}}=e,n=r.activeTrack(),a=r.getActiveGroup(),o=r.activePlaylistLoader,u=r.lastGroup_;if(!(a&&u&&a.id===u.id)&&(r.lastGroup_=a,r.lastTrack_=n,xm(t,r),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){o&&s.resetEverything();return}t.resyncLoader(),ul(a.playlistLoader,r)}},v1=(i,e)=>()=>{const{segmentLoaders:{[i]:t},mediaTypes:{[i]:s}}=e;s.lastGroup_=null,t.abort(),t.pause()},S1=(i,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[i]:s,main:r},mediaTypes:{[i]:n}}=e,a=n.activeTrack(),o=n.getActiveGroup(),u=n.activePlaylistLoader,c=n.lastTrack_;if(!(c&&a&&c.id===a.id)&&(n.lastGroup_=o,n.lastTrack_=a,xm(s,n),!!o)){if(o.isMainPlaylist){if(!a||!c||a.id===c.id)return;const p=e.vhs.playlistController_,y=p.selectPlaylist();if(p.media()===y)return;n.logger_(`track change. Switching main audio from ${c.id} to ${a.id}`),t.pause(),r.resetEverything(),p.fastQualityChange_(y);return}if(i==="AUDIO"){if(!o.playlistLoader){r.setAudio(!0),r.resetEverything();return}s.setAudio(!0),r.setAudio(!1)}if(u===o.playlistLoader){ul(o.playlistLoader,n);return}s.track&&s.track(a),s.resetEverything(),ul(o.playlistLoader,n)}},Zn={AUDIO:(i,e)=>()=>{const{mediaTypes:{[i]:t},excludePlaylist:s}=e,r=t.activeTrack(),n=t.activeGroup(),a=(n.filter(u=>u.default)[0]||n[0]).id,o=t.tracks[a];if(r===o){s({error:{message:"Problem encountered loading the default audio track."}});return}L.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const u in t.tracks)t.tracks[u].enabled=t.tracks[u]===o;t.onTrackChanged()},SUBTITLES:(i,e)=>()=>{const{mediaTypes:{[i]:t}}=e;L.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const s=t.activeTrack();s&&(s.mode="disabled"),t.onTrackChanged()}},Xd={AUDIO:(i,e,t)=>{if(!e)return;const{tech:s,requestOptions:r,segmentLoaders:{[i]:n}}=t;e.on("loadedmetadata",()=>{const a=e.media();n.playlist(a,r),(!s.paused()||a.endList&&s.preload()!=="none")&&n.load()}),e.on("loadedplaylist",()=>{n.playlist(e.media(),r),s.paused()||n.load()}),e.on("error",Zn[i](i,t))},SUBTITLES:(i,e,t)=>{const{tech:s,requestOptions:r,segmentLoaders:{[i]:n},mediaTypes:{[i]:a}}=t;e.on("loadedmetadata",()=>{const o=e.media();n.playlist(o,r),n.track(a.activeTrack()),(!s.paused()||o.endList&&s.preload()!=="none")&&n.load()}),e.on("loadedplaylist",()=>{n.playlist(e.media(),r),s.paused()||n.load()}),e.on("error",Zn[i](i,t))}},x1={AUDIO:(i,e)=>{const{vhs:t,sourceType:s,segmentLoaders:{[i]:r},requestOptions:n,main:{mediaGroups:a},mediaTypes:{[i]:{groups:o,tracks:u,logger_:c}},mainPlaylistLoader:p}=e,y=Lr(p.main);(!a[i]||Object.keys(a[i]).length===0)&&(a[i]={main:{default:{default:!0}}},y&&(a[i].main.default.playlists=p.main.playlists));for(const T in a[i]){o[T]||(o[T]=[]);for(const x in a[i][T]){let S=a[i][T][x],_;if(y?(c(`AUDIO group '${T}' label '${x}' is a main playlist`),S.isMainPlaylist=!0,_=null):s==="vhs-json"&&S.playlists?_=new Ji(S.playlists[0],t,n):S.resolvedUri?_=new Ji(S.resolvedUri,t,n):S.playlists&&s==="dash"?_=new rl(S.playlists[0],t,n,p):_=null,S=re({id:x,playlistLoader:_},S),Xd[i](i,S.playlistLoader,e),o[T].push(S),typeof u[x]>"u"){const A=new L.AudioTrack({id:x,kind:T1(S),enabled:!1,language:S.language,default:S.default,label:x});u[x]=A}}}r.on("error",Zn[i](i,e))},SUBTITLES:(i,e)=>{const{tech:t,vhs:s,sourceType:r,segmentLoaders:{[i]:n},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[i]:{groups:u,tracks:c}},mainPlaylistLoader:p}=e;for(const y in o[i]){u[y]||(u[y]=[]);for(const T in o[i][y]){if(!s.options_.useForcedSubtitles&&o[i][y][T].forced)continue;let x=o[i][y][T],S;if(r==="hls")S=new Ji(x.resolvedUri,s,a);else if(r==="dash"){if(!x.playlists.filter(A=>A.excludeUntil!==1/0).length)return;S=new rl(x.playlists[0],s,a,p)}else r==="vhs-json"&&(S=new Ji(x.playlists?x.playlists[0]:x.resolvedUri,s,a));if(x=re({id:T,playlistLoader:S},x),Xd[i](i,x.playlistLoader,e),u[y].push(x),typeof c[T]>"u"){const _=t.addRemoteTextTrack({id:T,kind:"subtitles",default:x.default&&x.autoselect,language:x.language,label:T},!1).track;c[T]=_}}}n.on("error",Zn[i](i,e))},"CLOSED-CAPTIONS":(i,e)=>{const{tech:t,main:{mediaGroups:s},mediaTypes:{[i]:{groups:r,tracks:n}}}=e;for(const a in s[i]){r[a]||(r[a]=[]);for(const o in s[i][a]){const u=s[i][a][o];if(!/^(?:CC|SERVICE)/.test(u.instreamId))continue;const c=t.options_.vhs&&t.options_.vhs.captionServices||{};let p={label:o,language:u.language,instreamId:u.instreamId,default:u.default&&u.autoselect};if(c[p.instreamId]&&(p=re(p,c[p.instreamId])),p.default===void 0&&delete p.default,r[a].push(re({id:o},u)),typeof n[o]>"u"){const y=t.addRemoteTextTrack({id:p.instreamId,kind:"captions",default:p.default,language:p.language,label:p.label},!1).track;n[o]=y}}}}},Em=(i,e)=>{for(let t=0;tt=>{const{mainPlaylistLoader:s,mediaTypes:{[i]:{groups:r}}}=e,n=s.media();if(!n)return null;let a=null;n.attributes[i]&&(a=r[n.attributes[i]]);const o=Object.keys(r);if(!a)if(i==="AUDIO"&&o.length>1&&Lr(e.main))for(let u=0;u"u"?a:t===null||!a?null:a.filter(u=>u.id===t.id)[0]||null},C1={AUDIO:(i,e)=>()=>{const{mediaTypes:{[i]:{tracks:t}}}=e;for(const s in t)if(t[s].enabled)return t[s];return null},SUBTITLES:(i,e)=>()=>{const{mediaTypes:{[i]:{tracks:t}}}=e;for(const s in t)if(t[s].mode==="showing"||t[s].mode==="hidden")return t[s];return null}},w1=(i,{mediaTypes:e})=>()=>{const t=e[i].activeTrack();return t?e[i].activeGroup(t):null},A1=i=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(c=>{x1[c](c,i)});const{mediaTypes:e,mainPlaylistLoader:t,tech:s,vhs:r,segmentLoaders:{["AUDIO"]:n,main:a}}=i;["AUDIO","SUBTITLES"].forEach(c=>{e[c].activeGroup=E1(c,i),e[c].activeTrack=C1[c](c,i),e[c].onGroupChanged=b1(c,i),e[c].onGroupChanging=v1(c,i),e[c].onTrackChanged=S1(c,i),e[c].getActiveGroup=w1(c,i)});const o=e.AUDIO.activeGroup();if(o){const c=(o.filter(y=>y.default)[0]||o[0]).id;e.AUDIO.tracks[c].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),n.setAudio(!0)):a.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(c=>e[c].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(c=>e[c].onGroupChanging())});const u=()=>{e.AUDIO.onTrackChanged(),s.trigger({type:"usage",name:"vhs-audio-change"})};s.audioTracks().addEventListener("change",u),s.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),r.on("dispose",()=>{s.audioTracks().removeEventListener("change",u),s.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),s.clearTracks("audio");for(const c in e.AUDIO.tracks)s.audioTracks().addTrack(e.AUDIO.tracks[c])},D1=()=>{const i={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{i[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:jt,activeTrack:jt,getActiveGroup:jt,onGroupChanged:jt,onTrackChanged:jt,lastTrack_:null,logger_:ht(`MediaGroups[${e}]`)}}),i};class Kd{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=Ke(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(t=>[t.ID,t])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class k1 extends L.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new Kd,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=ht("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const s=t.serverUri||t.serverURL;if(!s){this.logger_(`steering manifest URL is ${s}, cannot request steering manifest.`),this.trigger("error");return}if(s.startsWith("data:")){this.decodeDataUriManifest_(s.substring(s.indexOf(",")+1));return}this.steeringManifest.reloadUri=Ke(e,s),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!t)return;const s=e?t:this.getRequestURI(t);if(!s){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const r={contentSteeringInfo:{uri:s}};this.trigger({type:"contentsteeringloadstart",metadata:r}),this.request_=this.xhr_({uri:s,requestType:"content-steering-manifest"},(n,a)=>{if(n){if(a.status===410){this.logger_(`manifest request 410 ${n}.`),this.logger_(`There will be no more content steering requests to ${s} this session.`),this.excludedSteeringManifestURLs.add(s);return}if(a.status===429){const c=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${n}.`),this.logger_(`content steering will retry in ${c} seconds.`),this.startTTLTimeout_(parseInt(c,10));return}this.logger_(`manifest failed to load ${n}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:r});let o;try{o=JSON.parse(this.request_.responseText)}catch(c){const p={errorType:L.Error.StreamingContentSteeringParserError,error:c};this.trigger({type:"error",metadata:p})}this.assignSteeringProperties_(o);const u={contentSteeringInfo:r.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:u}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new C.URL(e),s=new C.URL(this.proxyServerUrl_);return s.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(s.toString())}decodeDataUriManifest_(e){const t=JSON.parse(C.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new C.URL(e),s=this.getPathway(),r=this.getBandwidth_();if(s){const n=`_${this.manifestType_}_pathway`;t.searchParams.set(n,s)}if(r){const n=`_${this.manifestType_}_throughput`;t.searchParams.set(n,r)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const s=(r=>{for(const n of r)if(this.availablePathways_.has(n))return n;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==s&&(this.currentPathway=s,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=r=>this.excludedSteeringManifestURLs.has(r);if(this.proxyServerUrl_){const r=this.setProxyServerUrl_(e);if(!t(r))return r}const s=this.setSteeringParams_(e);return t(s)?null:s}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=C.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){C.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new Kd}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(Ke(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const I1=(i,e)=>{let t=null;return(...s)=>{clearTimeout(t),t=setTimeout(()=>{i.apply(null,s)},e)}},P1=10;let ri;const O1=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],L1=function(i){return this.audioSegmentLoader_[i]+this.mainSegmentLoader_[i]},R1=function({currentPlaylist:i,buffered:e,currentTime:t,nextPlaylist:s,bufferLowWaterLine:r,bufferHighWaterLine:n,duration:a,bufferBasedABR:o,log:u}){if(!s)return L.log.warn("We received no playlist to switch to. Please check your stream."),!1;const c=`allowing switch ${i&&i.id||"null"} -> ${s.id}`;if(!i)return u(`${c} as current playlist is not set`),!0;if(s.id===i.id)return!1;const p=!!Qi(e,t).length;if(!i.endList)return!p&&typeof i.partTargetDuration=="number"?(u(`not ${c} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(u(`${c} as current playlist is live`),!0);const y=fu(e,t),T=o?ke.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:ke.MAX_BUFFER_LOW_WATER_LINE;if(aS)&&y>=r){let _=`${c} as forwardBuffer >= bufferLowWaterLine (${y} >= ${r})`;return o&&(_+=` and next bandwidth > current bandwidth (${x} > ${S})`),u(_),!0}return u(`not ${c} as no switching criteria met`),!1};class N1 extends L.EventTarget{constructor(e){super(),this.fastQualityChange_=I1(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:s,tech:r,bandwidth:n,externVhs:a,useCueTags:o,playlistExclusionDuration:u,enableLowInitialPlaylist:c,sourceType:p,cacheEncryptionKeys:y,bufferBasedABR:T,leastPixelDiffSelector:x,captionServices:S,experimentalUseMMS:_}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:A}=e;(A===null||typeof A>"u")&&(A=1/0),ri=a,this.bufferBasedABR=!!T,this.leastPixelDiffSelector=!!x,this.withCredentials=s,this.tech_=r,this.vhs_=r.vhs,this.player_=e.player_,this.sourceType_=p,this.useCueTags_=o,this.playlistExclusionDuration=u,this.maxPlaylistRetries=A,this.enableLowInitialPlaylist=c,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:s,maxPlaylistRetries:A,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=D1(),_&&C.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new C.ManagedMediaSource,this.usingManagedMediaSource_=!0,L.log("Using ManagedMediaSource")):C.MediaSource&&(this.mediaSource=new C.MediaSource),this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=Pe(),this.hasPlayed_=!1,this.syncController_=new m1(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new _1,this.sourceUpdater_=new vm(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new g1,this.keyStatusMap_=new Map;const D={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:S,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:n,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:y,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new rl(t,this.vhs_,re(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new Ji(t,this.vhs_,re(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new ol(re(D,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new ol(re(D,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new c1(re(D,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((O,R)=>{function q(){r.off("vttjserror",F),O()}function F(){r.off("vttjsloaded",q),R()}r.one("vttjsloaded",q),r.one("vttjserror",F),r.addWebVttScript_()})}),e);const P=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new k1(this.vhs_.xhr,P),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),O1.forEach(O=>{this[O+"_"]=L1.bind(this,O)}),this.logger_=ht("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const k=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(k,()=>{const O=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-O,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return e===-1||t===-1?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,s){const r=this.media(),n=r&&(r.id||r.uri),a=e&&(e.id||e.uri);if(n&&n!==a){this.logger_(`switch media ${n} -> ${a} from ${t}`);const o={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:o}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,s)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],s=t?t.activeGroup():null,r=this.contentSteeringController_.getPathway();if(s&&r){const a=(s.length?s[0].playlists:s.playlists).filter(o=>o.attributes.serviceLocation===r);a.length&&this.mediaTypes_[e].activePlaylistLoader.media(a[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=C.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(C.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const s=e.mediaGroups.AUDIO,r=Object.keys(s);let n;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)n=this.mediaTypes_.AUDIO.activeTrack();else{const o=s.main||r.length&&s[r[0]];for(const u in o)if(o[u].default){n={label:u};break}}if(!n)return t;const a=[];for(const o in s)if(s[o][n.label]){const u=s[o][n.label];if(u.playlists&&u.playlists.length)a.push.apply(a,u.playlists);else if(u.uri)a.push(u);else if(e.playlists.length)for(let c=0;c{const t=this.mainPlaylistLoader_.media(),s=t.targetDuration*1.5*1e3;Zo(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=s,t.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.mainSegmentLoader_.load()),A1({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),t),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let t=this.mainPlaylistLoader_.media();if(!t){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let s;if(this.enableLowInitialPlaylist&&(s=this.selectInitialPlaylist()),s||(s=this.selectPlaylist()),!s||!this.shouldSwitchToMedia_(s)||(this.initialMedia_=s,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{const t=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const t=this.mainPlaylistLoader_.media(),s=t.targetDuration*1.5*1e3;Zo(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=s,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const t=this.mainPlaylistLoader_.media();if(t.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(t)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(t=>{this.mainPlaylistLoader_.on(t,s=>{this.player_.trigger(ve({},s))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const s=e.mediaGroups||{};let r=!0;const n=Object.keys(s.AUDIO);for(const a in s.AUDIO)for(const o in s.AUDIO[a])s.AUDIO[a][o].uri||(r=!1);r&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(s.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),ri.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),n.length&&Object.keys(s.AUDIO[n[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,s=this.tech_.currentTime(),r=this.bufferLowWaterLine(),n=this.bufferHighWaterLine(),a=this.tech_.buffered();return R1({buffered:a,currentTime:s,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:r,bufferHighWaterLine:n,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const s=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:s.playlist,error:s})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{const s=this.audioSegmentLoader_.pendingSegment_;if(!s||!s.segment||!s.segment.syncInfo)return;const r=s.segment.syncInfo.end+.01;this.tech_.setCurrentTime(r)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{this.logger_("Fix bad timeline change. Restarting al segment loaders..."),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}),this.mainSegmentLoader_.on("earlyabort",s=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:P1}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const s=this.getCodecsOrExclude_();s&&this.sourceUpdater_.addOrChangeSourceBuffers(s)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(s=>{this.mainSegmentLoader_.on(s,r=>{this.player_.trigger(ve({},r))}),this.audioSegmentLoader_.on(s,r=>{this.player_.trigger(ve({},r))}),this.subtitleSegmentLoader_.on(s,r=>{this.player_.trigger(ve({},r))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime(){})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();!t||t.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const s=this.syncController_.getExpiredTime(e,this.duration());if(s===null)return!1;const r=ri.Playlist.playlistEnd(e,s),n=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return r-n<=kt;const o=a.end(a.length-1);return o-n<=kt&&r-o<=kt}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:s}){if(e=e||this.mainPlaylistLoader_.media(),s=s||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const r=this.mainPlaylistLoader_.main.playlists,n=r.filter(Da),a=n.length===1&&n[0]===e;if(r.length===1&&s!==1/0)return L.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){const S=this.pathwayAttribute_(e),_=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(S),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(S)},_);return}let x=!1;r.forEach(S=>{if(S===e)return;const _=S.excludeUntil;typeof _<"u"&&_!==1/0&&(x=!0,delete S.excludeUntil)}),x&&(L.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let o;e.playlistErrors_>this.maxPlaylistRetries?o=1/0:o=Date.now()+s*1e3,e.excludeUntil=o,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const u=this.selectPlaylist();if(!u){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const c=t.internal?this.logger_:L.log.warn,p=t.message?" "+t.message:"";c(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${p} Switching to playlist ${u.id}.`),u.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),u.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const y=u.targetDuration/2*1e3||5*1e3,T=typeof u.lastRequest=="number"&&Date.now()-u.lastRequest<=y;return this.switchMedia_(u,"exclude",a||T)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const s=[],r=e==="all";(r||e==="main")&&s.push(this.mainPlaylistLoader_);const n=[];(r||e==="audio")&&n.push("AUDIO"),(r||e==="subtitle")&&(n.push("CLOSED-CAPTIONS"),n.push("SUBTITLES")),n.forEach(a=>{const o=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;o&&s.push(o)}),["main","audio","subtitle"].forEach(a=>{const o=this[`${a}SegmentLoader_`];o&&(e===a||e==="all")&&s.push(o)}),s.forEach(a=>t.forEach(o=>{typeof a[o]=="function"&&a[o]()}))}setCurrentTime(e){const t=Qi(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(t&&t.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:ri.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const s=e.media();if(!s)return null;const r=this.syncController_.getMediaSequenceSync(t);if(r&&r.isReliable){const o=r.start,u=r.end;if(!isFinite(o)||!isFinite(u))return null;const c=ri.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,s),p=Math.max(o,u-c);return Pe([[o,p]])}const n=this.syncController_.getExpiredTime(s,this.duration());if(n===null)return null;const a=ri.Playlist.seekable(s,n,ri.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,s));return a.length?a:null}computeFinalSeekable_(e,t){if(!t)return e;const s=e.start(0),r=e.end(0),n=t.start(0),a=t.end(0);return n>r||s>a?e:Pe([[Math.max(s,n),Math.min(r,a)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let t;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!t))return;const s=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,t),!this.seekable_||s&&s.length&&this.seekable_.length&&s.start(0)===this.seekable_.start(0)&&s.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${Rp(this.seekable_)}]`);const r={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:r}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){const r=this.seekable();if(!r.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration0&&(s=Math.max(s,t.end(t.length-1))),this.mediaSource.duration!==s&&this.sourceUpdater_.setDuration(s)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const t=this.mediaTypes_[e].groups;for(const s in t)t[s].forEach(r=>{r.playlistLoader&&r.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),s=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!s)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const s=fr(this.main(),t),r={},n=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(r.video=s.video||e.main.videoCodec||J_),e.main.isMuxed&&(r.video+=`,${s.audio||e.main.audioCodec||Oc}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||n)&&(r.audio=s.audio||e.main.audioCodec||e.audio.audioCodec||Oc,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!r.audio&&!r.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(c,p)=>c?lr(p,this.usingManagedMediaSource_):ho(p),o={};let u;if(["video","audio"].forEach(function(c){if(r.hasOwnProperty(c)&&!a(e[c].isFmp4,r[c])){const p=e[c].isFmp4?"browser":"muxer";o[p]=o[p]||[],o[p].push(r[c]),c==="audio"&&(u=p)}}),n&&u&&t.attributes.AUDIO){const c=t.attributes.AUDIO;this.main().playlists.forEach(p=>{(p.attributes&&p.attributes.AUDIO)===c&&p!==t&&(p.excludeUntil=1/0)}),this.logger_(`excluding audio group ${c} as ${u} does not support codec(s): "${r.audio}"`)}if(Object.keys(o).length){const c=Object.keys(o).reduce((p,y)=>(p&&(p+=", "),p+=`${y} does not support codec(s): "${o[y].join(",")}"`,p),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:c},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const c=[];if(["video","audio"].forEach(p=>{const y=(Ct(this.sourceUpdater_.codecs[p]||"")[0]||{}).type,T=(Ct(r[p]||"")[0]||{}).type;y&&T&&y.toLowerCase()!==T.toLowerCase()&&c.push(`"${this.sourceUpdater_.codecs[p]}" -> "${r[p]}"`)}),c.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${c.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return r}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach(s=>{const r=e[s];if(t.indexOf(r.id)!==-1)return;t.push(r.id);const n=fr(this.main,r),a=[];n.audio&&!ho(n.audio)&&!lr(n.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${n.audio}`),n.video&&!ho(n.video)&&!lr(n.video,this.usingManagedMediaSource_)&&a.push(`video codec ${n.video}`),n.text&&n.text==="stpp.ttml.im1t"&&a.push(`text codec ${n.text}`),a.length&&(r.excludeUntil=1/0,this.logger_(`excluding ${r.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],s=this.main().playlists,r=vr(Ct(e)),n=Pd(r),a=r.video&&Ct(r.video)[0]||null,o=r.audio&&Ct(r.audio)[0]||null;Object.keys(s).forEach(u=>{const c=s[u];if(t.indexOf(c.id)!==-1||c.excludeUntil===1/0)return;t.push(c.id);const p=[],y=fr(this.mainPlaylistLoader_.main,c),T=Pd(y);if(!(!y.audio&&!y.video)){if(T!==n&&p.push(`codec count "${T}" !== "${n}"`),!this.sourceUpdater_.canChangeType()){const x=y.video&&Ct(y.video)[0]||null,S=y.audio&&Ct(y.audio)[0]||null;x&&a&&x.type.toLowerCase()!==a.type.toLowerCase()&&p.push(`video codec "${x.type}" !== "${a.type}"`),S&&o&&S.type.toLowerCase()!==o.type.toLowerCase()&&p.push(`audio codec "${S.type}" !== "${o.type}"`)}p.length&&(c.excludeUntil=1/0,this.logger_(`excluding ${c.id}: ${p.join(" && ")}`))}})}updateAdCues_(e){let t=0;const s=this.seekable();s.length&&(t=s.start(0)),h1(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=ke.GOAL_BUFFER_LENGTH,s=ke.GOAL_BUFFER_LENGTH_RATE,r=Math.max(t,ke.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*s,r)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=ke.BUFFER_LOW_WATER_LINE,s=ke.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(t,ke.MAX_BUFFER_LOW_WATER_LINE),n=Math.max(t,ke.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*s,this.bufferBasedABR?n:r)}bufferHighWaterLine(){return ke.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){Ud(this.inbandTextTracks_,"com.apple.streaming",this.tech_),zS({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,s){const r=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();Ud(this.inbandTextTracks_,e,this.tech_),jS({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:r,videoDuration:s})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(t=>{this.contentSteeringController_.on(t,s=>{this.trigger(ve({},s))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const t=this.main();(this.contentSteeringController_.didDASHTagChange(t.uri,t.contentSteering)||(()=>{const n=this.contentSteeringController_.getAvailablePathways(),a=[];for(const o of t.playlists){const u=o.attributes.serviceLocation;if(u&&(a.push(u),!n.has(u)))return!0}return!!(!a.length&&n.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const s=this.main().playlists,r=new Set;let n=!1;Object.keys(s).forEach(a=>{const o=s[a],u=this.pathwayAttribute_(o),c=u&&e!==u;o.excludeUntil===1/0&&o.lastExcludeReason_==="content-steering"&&!c&&(delete o.excludeUntil,delete o.lastExcludeReason_,n=!0);const y=!o.excludeUntil&&o.excludeUntil!==1/0;!r.has(o.id)&&c&&y&&(r.add(o.id),o.excludeUntil=1/0,o.lastExcludeReason_="content-steering",this.logger_(`excluding ${o.id} for ${o.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(a=>{const o=this.mediaTypes_[a];if(o.activePlaylistLoader){const u=o.activePlaylistLoader.media_;u&&u.attributes.serviceLocation!==e&&(n=!0)}}),n&&this.changeSegmentPathway_()}handlePathwayClones_(){const t=this.main().playlists,s=this.contentSteeringController_.currentPathwayClones,r=this.contentSteeringController_.nextPathwayClones;if(s&&s.size||r&&r.size){for(const[a,o]of s.entries())r.get(a)||(this.mainPlaylistLoader_.updateOrDeleteClone(o),this.contentSteeringController_.excludePathway(a));for(const[a,o]of r.entries()){const u=s.get(a);if(!u){t.filter(p=>p.attributes["PATHWAY-ID"]===o["BASE-ID"]).forEach(p=>{this.mainPlaylistLoader_.addClonePathway(o,p)}),this.contentSteeringController_.addAvailablePathway(a);continue}this.equalPathwayClones_(u,o)||(this.mainPlaylistLoader_.updateOrDeleteClone(o,!0),this.contentSteeringController_.addAvailablePathway(a))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...r])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;const s=e["URI-REPLACEMENT"].PARAMS,r=t["URI-REPLACEMENT"].PARAMS;for(const n in s)if(s[n]!==r[n])return!1;for(const n in r)if(s[n]!==r[n])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(s=>{const r=this.mainPlaylistLoader_.getKeyIdSet(s);!r||!r.size||r.forEach(n=>{const a="usable",o=this.keyStatusMap_.has(n)&&this.keyStatusMap_.get(n)===a,u=s.lastExcludeReason_===t&&s.excludeUntil===1/0;o?o&&u&&(delete s.excludeUntil,delete s.lastExcludeReason_,this.logger_(`enabling playlist ${s.id} because key ID ${n} is ${a}`)):(s.excludeUntil!==1/0&&s.lastExcludeReason_!==t&&(s.excludeUntil=1/0,s.lastExcludeReason_=t,this.logger_(`excluding playlist ${s.id} because the key ID ${n} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(s=>{const r=s&&s.attributes&&s.attributes.RESOLUTION&&s.attributes.RESOLUTION.height<720,n=s.excludeUntil===1/0&&s.lastExcludeReason_===t;r&&n&&(delete s.excludeUntil,L.log.warn(`enabling non-HD playlist ${s.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const n=(typeof e=="string"?e:l1(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${n} added to the keyStatusMap`),this.keyStatusMap_.set(n,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const M1=(i,e,t)=>s=>{const r=i.main.playlists[e],n=mu(r),a=Da(r);if(typeof s>"u")return a;s?delete r.disabled:r.disabled=!0;const o={renditionInfo:{id:e,bandwidth:r.attributes.BANDWIDTH,resolution:r.attributes.RESOLUTION,codecs:r.attributes.CODECS},cause:"fast-quality"};return s!==a&&!n&&(s?(t(r),i.trigger({type:"renditionenabled",metadata:o})):i.trigger({type:"renditiondisabled",metadata:o})),s};class B1{constructor(e,t,s){const{playlistController_:r}=e,n=r.fastQualityChange_.bind(r);if(t.attributes){const a=t.attributes.RESOLUTION;this.width=a&&a.width,this.height=a&&a.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=fr(r.main(),t),this.playlist=t,this.id=s,this.enabled=M1(e.playlists,t.id,n)}}const F1=function(i){i.representations=()=>{const e=i.playlistController_.main(),t=Lr(e)?i.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(s=>!mu(s)).map((s,r)=>new B1(i,s,s.id)):[]}},Yd=["seeking","seeked","pause","playing","error"];class U1 extends L.EventTarget{constructor(e){super(),this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=ht("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),s=()=>this.monitorCurrentTime_(),r=()=>this.techWaiting_(),n=()=>this.resetTimeUpdate_(),a=this.playlistController_,o=["main","subtitle","audio"],u={};o.forEach(p=>{u[p]={reset:()=>this.resetSegmentDownloads_(p),updateend:()=>this.checkSegmentDownloads_(p)},a[`${p}SegmentLoader_`].on("appendsdone",u[p].updateend),a[`${p}SegmentLoader_`].on("playlistupdate",u[p].reset),this.tech_.on(["seeked","seeking"],u[p].reset)});const c=p=>{["main","audio"].forEach(y=>{a[`${y}SegmentLoader_`][p]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),c("off"))},this.clearSeekingAppendCheck_=()=>c("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),c("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",r),this.tech_.on(Yd,n),this.tech_.on("canplay",s),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",r),this.tech_.off(Yd,n),this.tech_.off("canplay",s),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),o.forEach(p=>{a[`${p}SegmentLoader_`].off("appendsdone",u[p].updateend),a[`${p}SegmentLoader_`].off("playlistupdate",u[p].reset),this.tech_.off(["seeked","seeking"],u[p].reset)}),this.checkCurrentTimeTimeout_&&C.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&C.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=C.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,s=t[`${e}SegmentLoader_`],r=s.buffered_(),n=E2(this[`${e}Buffered_`],r);if(this[`${e}Buffered_`]=r,n){const a={bufferedRanges:r};t.trigger({type:"bufferedrangeschanged",metadata:a}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:s.playlist_&&s.playlist_.id,buffered:Ci(r)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+kt>=t.end(t.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(Pe([this.lastRecordedTime,e]));const s={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:s}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const t=this.seekable(),s=this.tech_.currentTime(),r=this.afterSeekableWindow_(t,s,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let n;if(r&&(n=t.end(t.length-1)),this.beforeSeekableWindow_(t,s)){const S=t.start(0);n=S+(S===t.end(0)?0:kt)}if(typeof n<"u")return this.logger_(`Trying to seek outside of seekable at time ${s} with seekable range ${Rp(t)}. Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0;const a=this.playlistController_.sourceUpdater_,o=this.tech_.buffered(),u=a.audioBuffer?a.audioBuffered():null,c=a.videoBuffer?a.videoBuffered():null,p=this.media(),y=p.partTargetDuration?p.partTargetDuration:(p.targetDuration-Dt)*2,T=[u,c];for(let S=0;S ${s.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const o=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${o}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(o),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const s=this.tech_.vhs.playlistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:s.audioBuffered(),videoBuffered:s.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const a=yn(r,t);return a.length>0?(this.logger_(`Stopped at ${t} and seeking to ${a.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,s,r=!1){if(!e.length)return!1;let n=e.end(e.length-1)+kt;const a=!s.endList,o=typeof s.partTargetDuration=="number";return a&&(o||r)&&(n=e.end(e.length-1)+s.targetDuration*3),t>n}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:n,end:a}}return null}}const q1={errorInterval:30,getSource(i){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return i(t)}},Cm=function(i,e){let t=0,s=0;const r=re(q1,e);i.ready(()=>{i.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const n=function(){s&&i.currentTime(s)},a=function(p){p!=null&&(s=i.duration()!==1/0&&i.currentTime()||0,i.one("loadedmetadata",n),i.src(p),i.trigger({type:"usage",name:"vhs-error-reload"}),i.play())},o=function(){if(Date.now()-t{Object.defineProperty(_e,i,{get(){return L.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),ke[i]},set(e){if(L.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){L.log.warn(`value of Vhs.${i} must be greater than or equal to 0`);return}ke[i]=e}})});const Am="videojs-vhs",Dm=function(i,e){const t=e.media();let s=-1;for(let r=0;r{i.addQualityLevel(t)}),Dm(i,e.playlists)};_e.canPlaySource=function(){return L.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const G1=(i,e,t)=>{if(!i)return i;let s={};e&&e.attributes&&e.attributes.CODECS&&(s=vr(Ct(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(s.audio=t.attributes.CODECS);const r=us(s.video),n=us(s.audio),a={};for(const o in i)a[o]={},n&&(a[o].audioContentType=n),r&&(a[o].videoContentType=r),e.contentProtection&&e.contentProtection[o]&&e.contentProtection[o].pssh&&(a[o].pssh=e.contentProtection[o].pssh),typeof i[o]=="string"&&(a[o].url=i[o]);return re(i,a)},X1=(i,e)=>i.reduce((t,s)=>{if(!s.contentProtection)return t;const r=e.reduce((n,a)=>{const o=s.contentProtection[a];return o&&o.pssh&&(n[a]={pssh:o.pssh}),n},{});return Object.keys(r).length&&t.push(r),t},[]),K1=({player:i,sourceKeySystems:e,audioMedia:t,mainPlaylists:s})=>{if(!i.eme.initializeMediaKeys)return Promise.resolve();const r=t?s.concat([t]):s,n=X1(r,Object.keys(e)),a=[],o=[];return n.forEach(u=>{o.push(new Promise((c,p)=>{i.tech_.one("keysessioncreated",c)})),a.push(new Promise((c,p)=>{i.eme.initializeMediaKeys({keySystems:u},y=>{if(y){p(y);return}c()})}))}),Promise.race([Promise.all(a),Promise.race(o)])},Y1=({player:i,sourceKeySystems:e,media:t,audioMedia:s})=>{const r=G1(e,t,s);return r?(i.currentSource().keySystems=r,r&&!i.eme?(L.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},km=()=>{if(!C.localStorage)return null;const i=C.localStorage.getItem(Am);if(!i)return null;try{return JSON.parse(i)}catch{return null}},Q1=i=>{if(!C.localStorage)return!1;let e=km();e=e?re(e,i):i;try{C.localStorage.setItem(Am,JSON.stringify(e))}catch{return!1}return e},J1=i=>i.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(i.substring(i.indexOf(",")+1)):i,Im=(i,e)=>{i._requestCallbackSet||(i._requestCallbackSet=new Set),i._requestCallbackSet.add(e)},Pm=(i,e)=>{i._responseCallbackSet||(i._responseCallbackSet=new Set),i._responseCallbackSet.add(e)},Om=(i,e)=>{i._requestCallbackSet&&(i._requestCallbackSet.delete(e),i._requestCallbackSet.size||delete i._requestCallbackSet)},Lm=(i,e)=>{i._responseCallbackSet&&(i._responseCallbackSet.delete(e),i._responseCallbackSet.size||delete i._responseCallbackSet)};_e.supportsNativeHls=function(){if(!j||!j.createElement)return!1;const i=j.createElement("video");return L.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(t){return/maybe|probably/i.test(i.canPlayType(t))}):!1}();_e.supportsNativeDash=function(){return!j||!j.createElement||!L.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(j.createElement("video").canPlayType("application/dash+xml"))}();_e.supportsTypeNatively=i=>i==="hls"?_e.supportsNativeHls:i==="dash"?_e.supportsNativeDash:!1;_e.isSupported=function(){return L.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};_e.xhr.onRequest=function(i){Im(_e.xhr,i)};_e.xhr.onResponse=function(i){Pm(_e.xhr,i)};_e.xhr.offRequest=function(i){Om(_e.xhr,i)};_e.xhr.offResponse=function(i){Lm(_e.xhr,i)};const Z1=L.getComponent("Component");class Rm extends Z1{constructor(e,t,s){if(super(t,s.vhs),typeof s.initialBandwidth=="number"&&(this.options_.bandwidth=s.initialBandwidth),this.logger_=ht("VhsHandler"),t.options_&&t.options_.playerId){const r=L.getPlayer(t.options_.playerId);this.player_=r}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(j,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],r=>{const n=j.fullscreenElement||j.webkitFullscreenElement||j.mozFullScreenElement||j.msFullscreenElement;n&&n.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=re(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.usePlayerObjectFit=this.options_.usePlayerObjectFit||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=typeof this.options_.useNetworkInformationApi<"u"?this.options_.useNetworkInformationApi:!0,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const s=km();s&&s.bandwidth&&(this.options_.bandwidth=s.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),s&&s.throughput&&(this.options_.throughput=s.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=ke.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===ke.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","usePlayerObjectFit","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(s=>{typeof this.source_[s]<"u"&&(this.options_[s]=this.source_[s])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio,this.usePlayerObjectFit=this.options_.usePlayerObjectFit;const t=this.options_.customPixelRatio;typeof t=="number"&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=J1(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=_e,this.options_.sourceType=wh(t),this.options_.seekTo=n=>{this.tech_.setCurrentTime(n)},this.options_.player_=this.player_,this.playlistController_=new N1(this.options_);const s=re({liveRangeSafeTimeDelta:kt},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new U1(s),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const n=L.players[this.tech_.options_.playerId];let a=this.playlistController_.error;typeof a=="object"&&!a.code?a.code=3:typeof a=="string"&&(a={message:a,code:3}),n.error(a)});const r=this.options_.bufferBasedABR?_e.movingAverageBandwidthSelector(.55):_e.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):r.bind(this),this.playlistController_.selectInitialPlaylist=_e.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(n){this.playlistController_.selectPlaylist=n.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(n){this.playlistController_.mainSegmentLoader_.throughput.rate=n,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let n=this.playlistController_.mainSegmentLoader_.bandwidth;const a=C.navigator.connection||C.navigator.mozConnection||C.navigator.webkitConnection,o=1e7;if(this.options_.useNetworkInformationApi&&a){const u=a.downlink*1e3*1e3;u>=o&&n>=o?n=Math.max(n,u):n=u}return n},set(n){this.playlistController_.mainSegmentLoader_.bandwidth=n,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const n=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(n+a))},set(){L.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>Ci(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>Ci(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&Q1({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{F1(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=C.URL.createObjectURL(this.playlistController_.mediaSource),(L.browser.IS_ANY_SAFARI||L.browser.IS_IOS)&&this.options_.overrideNative&&this.options_.sourceType==="hls"&&typeof this.tech_.addSourceElement=="function"?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),K1({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(t=>{this.logger_("error while creating EME key session",t),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=Y1({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",s=>{this.playlistController_.updatePlaylistByKeyStatus(s.keyId,s.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=L.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{W1(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{Dm(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":wm,"mux.js":j1,"mpd-parser":H1,"m3u8-parser":V1,"aes-decrypter":z1}}version(){return this.constructor.version()}canChangeType(){return vm.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&C.URL.revokeObjectURL&&(C.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return sS({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,s=!0,r=2){return rm({programTime:e,playlist:this.playlistController_.media(),retryCount:r,pauseAfterSeek:s,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{Im(this.xhr,e)},this.xhr.onResponse=e=>{Pm(this.xhr,e)},this.xhr.offRequest=e=>{Om(this.xhr,e)},this.xhr.offResponse=e=>{Lm(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(s=>{this.playlistController_.on(s,r=>{this.player_.trigger(ve({},r))})}),t.forEach(s=>{this.playbackWatcher_.on(s,r=>{this.player_.trigger(ve({},r))})})}}const ea={name:"videojs-http-streaming",VERSION:wm,canHandleSource(i,e={}){const t=re(L.options,e);return!t.vhs.experimentalUseMMS&&!lr("avc1.4d400d,mp4a.40.2",!1)?!1:ea.canPlayType(i.type,t)},handleSource(i,e,t={}){const s=re(L.options,t);return e.vhs=new Rm(i,e,s),e.vhs.xhr=Zp(),e.vhs.setupXhrHooks_(),e.vhs.src(i.src,i.type),e.vhs},canPlayType(i,e){const t=wh(i);if(!t)return"";const s=ea.getOverrideNative(e);return!_e.supportsTypeNatively(t)||s?"maybe":""},getOverrideNative(i={}){const{vhs:e={}}=i,t=!(L.browser.IS_ANY_SAFARI||L.browser.IS_IOS),{overrideNative:s=t}=e;return s}},ex=()=>lr("avc1.4d400d,mp4a.40.2",!0);ex()&&L.getTech("Html5").registerSourceHandler(ea,0);L.VhsHandler=Rm;L.VhsSourceHandler=ea;L.Vhs=_e;L.use||L.registerComponent("Vhs",_e);L.options.vhs=L.options.vhs||{};(!L.getPlugin||!L.getPlugin("reloadSourceOnError"))&&L.registerPlugin("reloadSourceOnError",$1);let Nm=function(){this.el=document.querySelector("[data-player] .video-js"),this.enabled=this.el!==null,this.el&&(this.player=L(this.el,{preload:"auto",controls:!1,loop:!1,autoplay:!0}),this.handleClickToPause())};Nm.prototype={ready(i){this.player.ready(i)},onPause(i){this.player.on("pause",i)},play(){this.player.play()},pause(){this.player.pause()},mute(){this.player.muted(!0)},unmute(){this.player.muted(!1)},handleClickToPause(){let i=this;this.el.addEventListener("click",function(){i.player.paused()?i.player.play():i.player.pause()})}};window._wq=window._wq||[];let Mm=function(){this.el=document.querySelector("[data-player]"),this.enabled=this.el!==null,this.isReady=!1};Mm.prototype={ready(i){let e=this;_wq.push({id:window.App.videoId,onReady:function(t){e.player=t,e.isReady=!0,i.call(e)}})},onPlay(i){this.player.bind("play",i)},onPause(i){this.player.bind("pause",i)},play(){this.isReady&&this.player.play()},pause(){this.isReady&&this.player.pause()},mute(){this.isReady&&this.player.mute()},unmute(){this.isReady&&this.player.unmute()}};const tx=Object.prototype.toString;function ix(i,e){return tx.call(i)===`[object ${e}]`}function Bm(i){return ix(i,"Object")}function Tu(i){return!!(i&&i.then&&typeof i.then=="function")}function bn(i){return i&&i.Math==Math?i:void 0}const _t=typeof globalThis=="object"&&bn(globalThis)||typeof window=="object"&&bn(window)||typeof self=="object"&&bn(self)||typeof global=="object"&&bn(global)||function(){return this}()||{};function Fm(i,e,t){const s=t||_t,r=s.__SENTRY__=s.__SENTRY__||{};return r[i]||(r[i]=e())}const sx=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,rx="Sentry Logger ",Qd=["debug","info","warn","error","log","assert","trace"],Jd={};function Um(i){if(!("console"in _t))return i();const e=_t.console,t={},s=Object.keys(Jd);s.forEach(r=>{const n=Jd[r];t[r]=e[r],e[r]=n});try{return i()}finally{s.forEach(r=>{e[r]=t[r]})}}function nx(){let i=!1;const e={enable:()=>{i=!0},disable:()=>{i=!1},isEnabled:()=>i};return sx?Qd.forEach(t=>{e[t]=(...s)=>{i&&Um(()=>{_t.console[t](`${rx}[${t}]:`,...s)})}}):Qd.forEach(t=>{e[t]=()=>{}}),e}const li=nx();function wi(i){return cl(i,new Map)}function cl(i,e){if(ax(i)){const t=e.get(i);if(t!==void 0)return t;const s={};e.set(i,s);for(const r of Object.keys(i))typeof i[r]<"u"&&(s[r]=cl(i[r],e));return s}if(Array.isArray(i)){const t=e.get(i);if(t!==void 0)return t;const s=[];return e.set(i,s),i.forEach(r=>{s.push(cl(r,e))}),s}return i}function ax(i){if(!Bm(i))return!1;try{const e=Object.getPrototypeOf(i).constructor.name;return!e||e==="Object"}catch{return!0}}function Lt(){const i=_t,e=i.crypto||i.msCrypto;let t=()=>Math.random()*16;try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(t=()=>{const s=new Uint8Array(1);return e.getRandomValues(s),s[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,s=>(s^(t()&15)>>s/4).toString(16))}function ox(i){return Array.isArray(i)?i:[i]}var qt;(function(i){i[i.PENDING=0]="PENDING";const t=1;i[i.RESOLVED=t]="RESOLVED";const s=2;i[i.REJECTED=s]="REJECTED"})(qt||(qt={}));class oi{constructor(e){oi.prototype.__init.call(this),oi.prototype.__init2.call(this),oi.prototype.__init3.call(this),oi.prototype.__init4.call(this),this._state=qt.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(t){this._reject(t)}}then(e,t){return new oi((s,r)=>{this._handlers.push([!1,n=>{if(!e)s(n);else try{s(e(n))}catch(a){r(a)}},n=>{if(!t)r(n);else try{s(t(n))}catch(a){r(a)}}]),this._executeHandlers()})}catch(e){return this.then(t=>t,e)}finally(e){return new oi((t,s)=>{let r,n;return this.then(a=>{n=!1,r=a,e&&e()},a=>{n=!0,r=a,e&&e()}).then(()=>{if(n){s(r);return}t(r)})})}__init(){this._resolve=e=>{this._setResult(qt.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(qt.REJECTED,e)}}__init3(){this._setResult=(e,t)=>{if(this._state===qt.PENDING){if(Tu(t)){t.then(this._resolve,this._reject);return}this._state=e,this._value=t,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===qt.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(t=>{t[0]||(this._state===qt.RESOLVED&&t[1](this._value),this._state===qt.REJECTED&&t[2](this._value),t[0]=!0)})}}}const qm=1e3;function bu(){return Date.now()/qm}function lx(){const{performance:i}=_t;if(!i||!i.now)return bu;const e=Date.now()-i.now(),t=i.timeOrigin==null?e:i.timeOrigin;return()=>(t+i.now())/qm}const $m=lx();(()=>{const{performance:i}=_t;if(!i||!i.now)return;const e=3600*1e3,t=i.now(),s=Date.now(),r=i.timeOrigin?Math.abs(i.timeOrigin+t-s):e,n=r"u"||__SENTRY_DEBUG__,jm="production";function ux(){return Fm("globalEventProcessors",()=>[])}function dl(i,e,t,s=0){return new oi((r,n)=>{const a=i[s];if(e===null||typeof a!="function")r(e);else{const o=a({...e},t);Cn&&a.id&&o===null&&li.log(`Event processor "${a.id}" dropped event`),Tu(o)?o.then(u=>dl(i,u,t,s+1).then(r)).then(null,n):dl(i,o,t,s+1).then(r).then(null,n)}})}function cx(i){const e=$m(),t={sid:Lt(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>hx(t)};return i&&ka(t,i),t}function ka(i,e={}){if(e.user&&(!i.ipAddress&&e.user.ip_address&&(i.ipAddress=e.user.ip_address),!i.did&&!e.did&&(i.did=e.user.id||e.user.email||e.user.username)),i.timestamp=e.timestamp||$m(),e.abnormal_mechanism&&(i.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(i.ignoreDuration=e.ignoreDuration),e.sid&&(i.sid=e.sid.length===32?e.sid:Lt()),e.init!==void 0&&(i.init=e.init),!i.did&&e.did&&(i.did=`${e.did}`),typeof e.started=="number"&&(i.started=e.started),i.ignoreDuration)i.duration=void 0;else if(typeof e.duration=="number")i.duration=e.duration;else{const t=i.timestamp-i.started;i.duration=t>=0?t:0}e.release&&(i.release=e.release),e.environment&&(i.environment=e.environment),!i.ipAddress&&e.ipAddress&&(i.ipAddress=e.ipAddress),!i.userAgent&&e.userAgent&&(i.userAgent=e.userAgent),typeof e.errors=="number"&&(i.errors=e.errors),e.status&&(i.status=e.status)}function dx(i,e){let t={};i.status==="ok"&&(t={status:"exited"}),ka(i,t)}function hx(i){return wi({sid:`${i.sid}`,init:i.init,started:new Date(i.started*1e3).toISOString(),timestamp:new Date(i.timestamp*1e3).toISOString(),status:i.status,errors:i.errors,did:typeof i.did=="number"||typeof i.did=="string"?`${i.did}`:void 0,duration:i.duration,abnormal_mechanism:i.abnormal_mechanism,attrs:{release:i.release,environment:i.environment,ip_address:i.ipAddress,user_agent:i.userAgent}})}const fx=1;function px(i){const{spanId:e,traceId:t}=i.spanContext(),{data:s,op:r,parent_span_id:n,status:a,tags:o,origin:u}=ta(i);return wi({data:s,op:r,parent_span_id:n,span_id:e,status:a,tags:o,trace_id:t,origin:u})}function ta(i){return mx(i)?i.getSpanJSON():typeof i.toJSON=="function"?i.toJSON():{}}function mx(i){return typeof i.getSpanJSON=="function"}function gx(i){const{traceFlags:e}=i.spanContext();return!!(e&fx)}function hl(i,e){const s={captureContext:e};return Pa().captureMessage(i,void 0,s)}function Hm(...i){const e=Pa();if(i.length===2){const[t,s]=i;return t?e.withScope(()=>(e.getStackTop().scope=t,s(t))):e.withScope(s)}return e.withScope(i[0])}function yx(){return Pa().getClient()}function _x(){return Pa().getScope()}function Vm(i){return i.transaction}function Tx(i,e,t){const s=e.getOptions(),{publicKey:r}=e.getDsn()||{},{segment:n}=t&&t.getUser()||{},a=wi({environment:s.environment||jm,release:s.release,user_segment:n,public_key:r,trace_id:i});return e.emit&&e.emit("createDsc",a),a}function bx(i){const e=yx();if(!e)return{};const t=Tx(ta(i).trace_id||"",e,_x()),s=Vm(i);if(!s)return t;const r=s&&s._frozenDynamicSamplingContext;if(r)return r;const{sampleRate:n,source:a}=s.metadata;n!=null&&(t.sample_rate=`${n}`);const o=ta(s);return a&&a!=="url"&&(t.transaction=o.description),t.sampled=String(gx(s)),e.emit&&e.emit("createDsc",t),t}function vx(i,e){const{fingerprint:t,span:s,breadcrumbs:r,sdkProcessingMetadata:n}=e;Sx(i,e),s&&Cx(i,s),wx(i,t),xx(i,r),Ex(i,n)}function Sx(i,e){const{extra:t,tags:s,user:r,contexts:n,level:a,transactionName:o}=e,u=wi(t);u&&Object.keys(u).length&&(i.extra={...u,...i.extra});const c=wi(s);c&&Object.keys(c).length&&(i.tags={...c,...i.tags});const p=wi(r);p&&Object.keys(p).length&&(i.user={...p,...i.user});const y=wi(n);y&&Object.keys(y).length&&(i.contexts={...y,...i.contexts}),a&&(i.level=a),o&&(i.transaction=o)}function xx(i,e){const t=[...i.breadcrumbs||[],...e];i.breadcrumbs=t.length?t:void 0}function Ex(i,e){i.sdkProcessingMetadata={...i.sdkProcessingMetadata,...e}}function Cx(i,e){i.contexts={trace:px(e),...i.contexts};const t=Vm(e);if(t){i.sdkProcessingMetadata={dynamicSamplingContext:bx(e),...i.sdkProcessingMetadata};const s=ta(t).description;s&&(i.tags={transaction:s,...i.tags})}}function wx(i,e){i.fingerprint=i.fingerprint?ox(i.fingerprint):[],e&&(i.fingerprint=i.fingerprint.concat(e)),i.fingerprint&&!i.fingerprint.length&&delete i.fingerprint}const Ax=100;class ls{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=Zd()}static clone(e){return e?e.clone():new ls}clone(){const e=new ls;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},e._user=this._user,e._level=this._level,e._span=this._span,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e}setClient(e){this._client=e}getClient(){return this._client}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,segment:void 0,username:void 0},this._session&&ka(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return t===null?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSpan(e){return this._span=e,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){const e=this._span;return e&&e.transaction}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t=typeof e=="function"?e(this):e;if(t instanceof ls){const s=t.getScopeData();this._tags={...this._tags,...s.tags},this._extra={...this._extra,...s.extra},this._contexts={...this._contexts,...s.contexts},s.user&&Object.keys(s.user).length&&(this._user=s.user),s.level&&(this._level=s.level),s.fingerprint.length&&(this._fingerprint=s.fingerprint),t.getRequestSession()&&(this._requestSession=t.getRequestSession()),s.propagationContext&&(this._propagationContext=s.propagationContext)}else if(Bm(t)){const s=e;this._tags={...this._tags,...s.tags},this._extra={...this._extra,...s.extra},this._contexts={...this._contexts,...s.contexts},s.user&&(this._user=s.user),s.level&&(this._level=s.level),s.fingerprint&&(this._fingerprint=s.fingerprint),s.requestSession&&(this._requestSession=s.requestSession),s.propagationContext&&(this._propagationContext=s.propagationContext)}return this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this._propagationContext=Zd(),this}addBreadcrumb(e,t){const s=typeof t=="number"?t:Ax;if(s<=0)return this;const r={timestamp:bu(),...e},n=this._breadcrumbs;return n.push(r),this._breadcrumbs=n.length>s?n.slice(-s):n,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}getAttachments(){return this.getScopeData().attachments}clearAttachments(){return this._attachments=[],this}getScopeData(){const{_breadcrumbs:e,_attachments:t,_contexts:s,_tags:r,_extra:n,_user:a,_level:o,_fingerprint:u,_eventProcessors:c,_propagationContext:p,_sdkProcessingMetadata:y,_transactionName:T,_span:x}=this;return{breadcrumbs:e,attachments:t,contexts:s,tags:r,extra:n,user:a,level:o,fingerprint:u||[],eventProcessors:c,propagationContext:p,sdkProcessingMetadata:y,transactionName:T,span:x}}applyToEvent(e,t={},s=[]){vx(e,this.getScopeData());const r=[...s,...ux(),...this._eventProcessors];return dl(r,e,t)}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...e},this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){const s=t&&t.event_id?t.event_id:Lt();if(!this._client)return li.warn("No client configured on scope - will not capture exception!"),s;const r=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:s},this),s}captureMessage(e,t,s){const r=s&&s.event_id?s.event_id:Lt();if(!this._client)return li.warn("No client configured on scope - will not capture message!"),r;const n=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:n,...s,event_id:r},this),r}captureEvent(e,t){const s=t&&t.event_id?t.event_id:Lt();return this._client?(this._client.captureEvent(e,{...t,event_id:s},this),s):(li.warn("No client configured on scope - will not capture event!"),s)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function Zd(){return{traceId:Lt(),spanId:Lt().substring(16)}}const Dx="7.120.3",zm=parseFloat(Dx),kx=100;class Wm{constructor(e,t,s,r=zm){this._version=r;let n;t?n=t:(n=new ls,n.setClient(e));let a;s?a=s:(a=new ls,a.setClient(e)),this._stack=[{scope:n}],e&&this.bindClient(e),this._isolationScope=a}isOlderThan(e){return this._version(this.popScope(),r),r=>{throw this.popScope(),r}):(this.popScope(),s)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(e,t){const s=this._lastEventId=t&&t.event_id?t.event_id:Lt(),r=new Error("Sentry syntheticException");return this.getScope().captureException(e,{originalException:e,syntheticException:r,...t,event_id:s}),s}captureMessage(e,t,s){const r=this._lastEventId=s&&s.event_id?s.event_id:Lt(),n=new Error(e);return this.getScope().captureMessage(e,t,{originalException:e,syntheticException:n,...s,event_id:r}),r}captureEvent(e,t){const s=t&&t.event_id?t.event_id:Lt();return e.type||(this._lastEventId=s),this.getScope().captureEvent(e,{...t,event_id:s}),s}lastEventId(){return this._lastEventId}addBreadcrumb(e,t){const{scope:s,client:r}=this.getStackTop();if(!r)return;const{beforeBreadcrumb:n=null,maxBreadcrumbs:a=kx}=r.getOptions&&r.getOptions()||{};if(a<=0)return;const u={timestamp:bu(),...e},c=n?Um(()=>n(u,t)):u;c!==null&&(r.emit&&r.emit("beforeAddBreadcrumb",c,t),s.addBreadcrumb(c,a))}setUser(e){this.getScope().setUser(e),this.getIsolationScope().setUser(e)}setTags(e){this.getScope().setTags(e),this.getIsolationScope().setTags(e)}setExtras(e){this.getScope().setExtras(e),this.getIsolationScope().setExtras(e)}setTag(e,t){this.getScope().setTag(e,t),this.getIsolationScope().setTag(e,t)}setExtra(e,t){this.getScope().setExtra(e,t),this.getIsolationScope().setExtra(e,t)}setContext(e,t){this.getScope().setContext(e,t),this.getIsolationScope().setContext(e,t)}configureScope(e){const{scope:t,client:s}=this.getStackTop();s&&e(t)}run(e){const t=eh(this);try{e(this)}finally{eh(t)}}getIntegration(e){const t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch{return Cn&&li.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,t){const s=this._callExtensionMethod("startTransaction",e,t);return Cn&&!s&&(this.getClient()?li.warn(`Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init': Sentry.addTracingExtensions(); Sentry.init({...}); `):li.warn("Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")),s}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(e=!1){if(e)return this.endSession();this._sendSessionUpdate()}endSession(){const t=this.getStackTop().scope,s=t.getSession();s&&dx(s),this._sendSessionUpdate(),t.setSession()}startSession(e){const{scope:t,client:s}=this.getStackTop(),{release:r,environment:n=jm}=s&&s.getOptions()||{},{userAgent:a}=_t.navigator||{},o=cx({release:r,environment:n,user:t.getUser(),...a&&{userAgent:a},...e}),u=t.getSession&&t.getSession();return u&&u.status==="ok"&&ka(u,{status:"exited"}),this.endSession(),t.setSession(o),o}shouldSendDefaultPii(){const e=this.getClient(),t=e&&e.getOptions();return!!(t&&t.sendDefaultPii)}_sendSessionUpdate(){const{scope:e,client:t}=this.getStackTop(),s=e.getSession();s&&t&&t.captureSession&&t.captureSession(s)}_callExtensionMethod(e,...t){const r=Ia().__SENTRY__;if(r&&r.extensions&&typeof r.extensions[e]=="function")return r.extensions[e].apply(this,t);Cn&&li.warn(`Extension method ${e} couldn't be found, doing nothing.`)}}function Ia(){return _t.__SENTRY__=_t.__SENTRY__||{extensions:{},hub:void 0},_t}function eh(i){const e=Ia(),t=fl(e);return Gm(e,i),t}function Pa(){const i=Ia();if(i.__SENTRY__&&i.__SENTRY__.acs){const e=i.__SENTRY__.acs.getCurrentHub();if(e)return e}return Ix(i)}function Ix(i=Ia()){return(!Px(i)||fl(i).isOlderThan(zm))&&Gm(i,new Wm),fl(i)}function Px(i){return!!(i&&i.__SENTRY__&&i.__SENTRY__.hub)}function fl(i){return Fm("hub",()=>new Wm,i)}function Gm(i,e){if(!i)return!1;const t=i.__SENTRY__=i.__SENTRY__||{};return t.hub=e,!0}let Xm=function(){this.el=document.querySelector("[data-player]"),this.enabled=this.el!==null,this.isReady=!1,this.start=performance.now(),this.subtitlesContainer=this.el.querySelector("[data-player-subtitles]"),this.injectScript(),this.injectPauseOverlay()};Xm.prototype={injectScript(){let i=document.createElement("script"),e=document.getElementsByTagName("script")[0];i.src="https://www.youtube.com/iframe_api",e.parentNode.insertBefore(i,e)},injectPauseOverlay(){this.pauseOverlay=document.createElement("div"),this.pauseOverlay.style.width="100%",this.pauseOverlay.style.height="100%",this.pauseOverlay.style.position="absolute",this.pauseOverlay.style.top=0,this.pauseOverlay.style.left=0,this.pauseOverlay.style.zIndex=100,window.App.playerShowControls&&(this.pauseOverlay.style.display="none"),this.el.querySelector("[data-player-wrapper]").appendChild(this.pauseOverlay);let i=this;this.pauseOverlay.addEventListener("click",function(){i.pause()})},ready(i){let e=this;window.onYouTubeIframeAPIReady=function(){e.player=new YT.Player("player",{width:"100%",videoId:window.App.videoId,playerVars:{mute:1,controls:window.App.playerShowControls?1:0,modestbranding:1,rel:0,playsinline:1,start:0,cc_load_policy:window.App.subtitles,autoplay:1},events:{onReady:function(){e.resizePlayer(),window.addEventListener("resize",function(){e.resizePlayer()}),document.querySelector("[data-player-dim]"),e.triggerReadyCallback(i),e.play(),window.App.firstPlay=!0},onApiChange:function(){e.player.setOption("captions","fontSize",2)}}})}},triggerReadyCallback(i){let e=this.getLoadTime(this.start);e>window.App.loadThreshold&&Hm(t=>{t.setLevel("info"),t.setExtra("Load time (sec):",{"Since page start":Math.floor(this.getLoadTime(window.App.start)),"Since player init":Math.floor(e)}),hl("[YouTube] Slow player load time")}),this.isReady=!0,i.call()},getLoadTime(i){return(performance.now()-i)/1e3},resizePlayer(){let i=window.innerWidth<=600,e=window.innerWidth*1.3;window.App.playerShowControls?this.el.style.height=document.getElementById("player").offsetHeight-70+"px":this.el.style.height=document.getElementById("player").offsetHeight-122+"px",i&&(this.el.style.height=e+"px"),window.location.href.includes("upgrade")},onPlay(i){let e=this,s=document.querySelector("[data-player-wrapper] > iframe").src.split("embed/")[1].split("?")[0];this.player.addEventListener("onStateChange",function(r){r.data===YT.PlayerState.PLAYING&&(i.call(),e.loadSubtitles(s),e.showSubtitles())}),setInterval(()=>{localStorage.setItem("videoCurrentTime",this.player.getCurrentTime().toFixed(2))},1e3)},onPause(i){let e=this;this.player.addEventListener("onStateChange",function(t){t.data===YT.PlayerState.PAUSED&&(i.call(),window.localStorage.getItem("videoCurrentTime"),window.App.offer_name,window.location.pathname.split("/")[1],e.pauseSubtitles())})},play(){this.isReady&&this.player.playVideo()},pause(){this.isReady&&this.player.pauseVideo()},mute(){this.isReady&&this.player.mute()},unmute(){this.isReady&&(window.App.firstPlay&&(window.App.firstPlay=!1,this.player.seekTo(0)),this.player.unMute())},loadSubtitles(i){typeof subtitlesData>"u"||!subtitlesData.length||(subtitlesData=allSubtitles[i]??[])},showSubtitles(){if(typeof subtitlesData>"u"||!subtitlesData.length)return;let i=this;this.subtitlesInterval=setInterval(function(){let e=i.subtitlesContainer.innerHTML,t=i.getSubtitleText(i.player.getCurrentTime());i.subtitlesContainer.style.display=t===""?"none":"block",e!==t&&(i.subtitlesContainer.innerHTML=t)},100)},autocompleteTextArea(i){let e=document.querySelector("[data-video-chat-wrapper]"),t=document.querySelector("[data-messages-container]"),s=document.createElement("div");if(s.className="message-wrapper",s.innerHTML=chatbotTimestamps[i],t.append(s),t.scrollTop=t.scrollHeight,e.getAttribute("data-active")===null){let r=document.querySelector("[data-popup-wrapper]"),n=document.createElement("div");n.className="tooltip-wrapper",n.innerHTML=chatbotTimestamps[i],r.append(n),setTimeout(()=>{n.classList.add("tooltip-fade-out"),setTimeout(()=>{n.remove()},1e3)},2e3)}},pauseSubtitles(){typeof subtitlesData>"u"||!subtitlesData.length||clearInterval(this.subtitlesInterval)},getSubtitleText(i){let e=subtitlesData.filter(t=>i>t.startTime&&i "):""}};let Km=function(){this.el=document.querySelector("[data-player]"),this.player=this.el.querySelector("video"),this.enabled=this.player!==null,this.isReady=!1,this.start=performance.now(),this.player.disablePictureInPicture=!0,this.subtitlesContainer=this.el.querySelector("[data-player-subtitles]"),this.injectPauseOverlay()};Km.prototype={injectPauseOverlay(){this.pauseOverlay=document.createElement("div"),this.pauseOverlay.style.width="100%",this.pauseOverlay.style.height="100%",this.pauseOverlay.style.position="absolute",this.pauseOverlay.style.top=0,this.pauseOverlay.style.left=0,this.pauseOverlay.style.zIndex=100,window.App.playerShowControls&&(this.pauseOverlay.style.display="none"),this.el.querySelector("[data-player-wrapper]").appendChild(this.pauseOverlay);let i=this;this.pauseOverlay.addEventListener("click",function(){i.pause()})},ready(i){let e=this;this.player.readyState>=this.player.HAVE_FUTURE_DATA?this.triggerReadyCallback(i,"readyState: HAVE_FUTURE_DATA"):this.player.addEventListener("loadedmetadata",function(){e.triggerReadyCallback(i,"event: loadedmetadata")},!1),setTimeout(function(){e.isReady||(hl("[Google Cloud] Player load timeout"),e.triggerReadyCallback(i,"timeout"))},1e4),window.App.firstPlay=!0},triggerReadyCallback(i){let e=this.getLoadTime(this.start);e>window.App.loadThreshold&&Hm(t=>{t.setLevel("info"),t.setExtra("Load time (sec):",{"Since page start":Math.floor(this.getLoadTime(window.App.start)),"Since player init":Math.floor(e)}),hl("[Google Cloud] Slow player load time")}),this.isReady=!0,i.call(this)},getLoadTime(i){return(performance.now()-i)/1e3},onPlay(i){let e=this,s=document.querySelector("[data-player-wrapper] > video > source").src.match(/\/([^/]+)\.mp4$/)[1];this.player.addEventListener("play",function(){i.call(this),e.loadSubtitles(s),e.showSubtitles()})},onPause(i){let e=this;this.player.addEventListener("pause",function(){i.call(this),e.pauseSubtitles()})},play(){this.player.play()},pause(){this.player.pause()},mute(){this.player.muted=!0},unmute(){this.player.muted=!1,window.App.firstPlay&&(window.App.firstPlay=!1,this.player.currentTime=0)},loadSubtitles(i){subtitlesData.length&&(subtitlesData=allSubtitles[i])},showSubtitles(){if(!subtitlesData.length)return;let i=this;this.subtitlesInterval=setInterval(function(){let e=i.subtitlesContainer.innerHTML,t=i.getSubtitleText(i.player.currentTime);i.subtitlesContainer.style.display=t===""?"none":"block",e!==t&&(i.subtitlesContainer.innerHTML=t)},100)},autocompleteTextArea(i){let e=document.querySelector("[data-video-chat-wrapper]"),t=document.querySelector("[data-messages-container]"),s=document.createElement("div");if(s.className="message-wrapper",s.innerHTML=chatbotTimestamps[i],t.append(s),t.scrollTop=t.scrollHeight,e.getAttribute("data-active")===null){let r=document.querySelector("[data-popup-wrapper]"),n=document.createElement("div");n.className="tooltip-wrapper",n.innerHTML=chatbotTimestamps[i],r.append(n),setTimeout(()=>{n.classList.add("tooltip-fade-out"),setTimeout(()=>{n.remove()},1e3)},2e3)}},pauseSubtitles(){subtitlesData.length&&clearInterval(this.subtitlesInterval)},getSubtitleText(i){let e=subtitlesData.filter(t=>i>t.startTime&&i "):""}};(function(){let i={videojs:Nm,wistia:Mm,youtube:Xm,cloud:Km};if(!i.hasOwnProperty(window.App.playerType)||(window.player=new i[window.App.playerType],window.isFullscreen=!1,!player.enabled))return;player.ready(function(){if(window.playerReady=!0,getUrlParameter("video")==="0"){player.style.display="none";return}window.App.playerType!=="cloud"&&window.App.autoplay&&getUrlParameter("ap")!=="0"&&player.play(),document.querySelector("[data-player-thumbnail]").style.display="none";let n=document.querySelector("[data-player-play]"),a=document.querySelector("[data-player-mobile-play]"),o=document.querySelector("[data-player-unmute]"),u=document.querySelector("[data-player-dim]");u.style.visibility="visible",window.App.isMobile&&(a.style.display="flex"),o.style.display=window.App.muted&&getUrlParameter("m")!=="1"?"flex":"none",!window.App.isMobile&&(getUrlParameter("ap")===!1&&!window.App.autoplay||getUrlParameter("ap")==="0")&&(window.App.playerShowControls?(n.style.display="none",o.style.display="none"):(n.style.display="flex",o.style.display="none"),player.unmute()),player.onPause(function(){window.App.playerShowControls==!1&&(n.style.display="flex",u.classList.remove("is-dimmed")),window.modals.open}),player.onPlay(function(p){n.style.display="none",u.classList.add("is-dimmed")});let c=function(p){p.preventDefault(),player.play(),player.unmute(),n.style.display="none",a.style.display="none",window.modals.open};n.addEventListener("click",c),a.addEventListener("click",c),o.addEventListener("click",function(p){p.preventDefault(),window.modals.open,player.unmute(),o.style.display="none"})}),window.scrollToPlayer=function(){window.scrollToElement(document.body)};function e(){let n=window.innerWidth/window.innerHeight,a=document.querySelector("[data-player-fullscreen]"),o=document.querySelector("[data-player-subtitles]");if(n>1.78&&a.getAttribute("data-fullscreen")){let c=(window.innerWidth-window.innerHeight*1.7777777777777777)/window.innerWidth*65;o.style.marginBottom=c+"%"}}function t(){window.App.videoOpensFull&&document.querySelector("[data-player-fullscreen]")&&(window.isFullscreen?r():s())}function s(){if(window.App.videoOpensFull){let n=document.querySelector("[data-player-fullscreen]"),a=document.querySelector("[data-vsl-container]"),o=document.querySelector("[data-vsl]"),u=document.querySelector("[data-player]");n&&(n.setAttribute("data-fullscreen","true"),n.removeAttribute("data-video-exit-fullscreen"),a.style.maxWidth="none",o.style.maxWidth="none",u.style.height=document.getElementById("player").offsetHeight-122+"px",u.scrollIntoView(),window.isFullscreen=!0)}}function r(){if(window.App.videoOpensFull){let n=document.querySelector("[data-player-fullscreen]"),a=document.querySelector("[data-vsl-container]"),o=document.querySelector("[data-vsl]"),u=document.querySelector("[data-player]");n&&(n.setAttribute("data-video-exit-fullscreen","true"),n.removeAttribute("data-fullscreen"),a.style.maxWidth="900px",o.style.maxWidth="900px",u.style.height=document.getElementById("player").offsetHeight-122+"px",window.isFullscreen=!1)}}window.adjustSubttilesOnWideScreen=e,window.toggleFullscreenVideo=t,window.setFullscreenVideo=s,window.exitFullscreenVideo=r})();(function(){let i=document.querySelector("[data-cta]"),e=document.querySelector("[data-cta-hide]");if(!i||window.App.ctaTimer===!1)return;let t=(window.App.ctaParam?window.App.ctaParam:window.App.ctaTimer?window.App.ctaTimer:60)*1e3;setTimeout(function(){let s=setInterval(function(){window.playerReady!==void 0&&(i.style.display="flex",e&&(e.style.display="none"),getStarted(),clearInterval(s))},100)},t)})();let Io=document.querySelector("[data-scroll-to-top]"),Ym=function(){const i=document.documentElement.scrollTop||document.body.scrollTop;i>0&&(window.requestAnimationFrame(Ym),window.scrollTo(0,i-i/8))};if(Io){let i=window.innerHeight;window.addEventListener("scroll",function(){Io.style.display=window.scrollY>i?"flex":"none"}),Io.addEventListener("click",function(){Ym()})}(function(){let i=document.querySelector("[data-buy-button]"),e=document.querySelector("[data-buy-button-price]"),t=document.querySelector("[data-product-addon1]"),s=document.querySelector("[data-product-addon2]");if(!i||!e||!t||!s)return;let r=function(){let n="base";t.checked&&(n="addon1"),s.checked&&(n="addon2"),t.checked&&s.checked&&(n="full"),e.innerHTML=App.productVariants[n][0],i.href=App.productVariants[n][1]};t.addEventListener("click",r),s.addEventListener("click",r)})();(function(){let i=document.querySelector("[data-members-area]"),e=document.querySelector("[data-members-area-loader]");if(!i&&!e||i&&!e)return;let t,s=5,r=1;t=setInterval(function(){if(r>s){window.location="/login";return}let a=new XMLHttpRequest;a.addEventListener("load",function(){JSON.parse(this.responseText).ready&&(location.reload(!0),clearInterval(t)),r++}),a.open("GET","/members/check"),a.send()},1e3)})();(function(){document.querySelectorAll("[data-show-element]").forEach(function(i){i.addEventListener("click",function(e){e.preventDefault();let t=document.querySelector(i.hash);t&&(t.style.display=i.hasAttribute("data-show-element-flex")?"flex":"block",t.scrollIntoView({behavior:"smooth"}))})})})();(function(){let i,e=window.document.title,t=!1;window.addEventListener("blur",function(){i=setInterval(function(){document.title=t?e:window.App.unfocusedTitle,t=!t},1e3)}),window.addEventListener("focus",function(){clearInterval(i),document.title=e})})();(function(){document.querySelectorAll("[data-countdown]").forEach(function(i){let e,t=!1,s=i.querySelector("[data-countdown-timer]"),r=parseInt(i.getAttribute("data-time")),n=i.querySelector("[data-countdown-message]"),a=i.querySelector("[data-countdown-finished-message]"),o=function(){return e=new Date(Date.parse(new Date)+r*1e3),t=!0,e},u=function(y){let T=Date.parse(y)-Date.parse(new Date),x=Math.floor(T/1e3%60),S=Math.floor(T/1e3/60%60),_=Math.floor(T/(1e3*60*60)%24),A=Math.floor(T/(1e3*60*60*24));return{total:T,days:A,hours:_,minutes:S,seconds:x}},c=function(y){return("0"+y).slice(-2)},p=setInterval(function(){if(!window.elementIsVisible(s)&&!t)return;t||(e=o());let y=u(e),T="";y.days>0&&(T=y.days+":"),y.hours>0&&(T+=c(y.hours)+":"),T+=c(y.minutes)+":",T+=c(y.seconds),y.total<=0?(n&&(n.style.display="none"),a&&(a.style.display="inline"),s.innerHTML="00:00",clearInterval(p)):s.innerHTML=T},1e3)})})();(function(){let i=function(t){let s=t.querySelector("iframe");t.querySelector("[data-youtube-container]").style.height=s.offsetHeight-122+"px"};window.resizePlayers=function(t,s=250){setTimeout(function(){t.querySelectorAll("[data-youtube-embed]:not(.is-plain)").forEach(function(r){i(r)})},s)},function(){document.querySelectorAll("[data-youtube-embed]:not(.is-plain)").forEach(function(t){t.querySelector("iframe").onload=function(){i(t),window.addEventListener("resize",_debounce(function(){i(t)},250))}})}()})();window.getStarted=function(){hideTranscriptButton(),resizePlayers(document.querySelector("#cta")),document.querySelector(".vsl-container").classList.remove("full-height");const i=new Event("wheel");window.dispatchEvent(i)};function Qm(i,e){return function(){return i.apply(e,arguments)}}const{toString:Ox}=Object.prototype,{getPrototypeOf:vu}=Object,{iterator:Oa,toStringTag:Jm}=Symbol,La=(i=>e=>{const t=Ox.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),vt=i=>(i=i.toLowerCase(),e=>La(e)===i),Ra=i=>e=>typeof e===i,{isArray:ks}=Array,Sr=Ra("undefined");function Lx(i){return i!==null&&!Sr(i)&&i.constructor!==null&&!Sr(i.constructor)&&Je(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const Zm=vt("ArrayBuffer");function Rx(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&Zm(i.buffer),e}const Nx=Ra("string"),Je=Ra("function"),eg=Ra("number"),Na=i=>i!==null&&typeof i=="object",Mx=i=>i===!0||i===!1,wn=i=>{if(La(i)!=="object")return!1;const e=vu(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Jm in i)&&!(Oa in i)},Bx=vt("Date"),Fx=vt("File"),Ux=vt("Blob"),qx=vt("FileList"),$x=i=>Na(i)&&Je(i.pipe),jx=i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||Je(i.append)&&((e=La(i))==="formdata"||e==="object"&&Je(i.toString)&&i.toString()==="[object FormData]"))},Hx=vt("URLSearchParams"),[Vx,zx,Wx,Gx]=["ReadableStream","Request","Response","Headers"].map(vt),Xx=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Rr(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let s,r;if(typeof i!="object"&&(i=[i]),ks(i))for(s=0,r=i.length;s0;)if(r=t[s],e===r.toLowerCase())return r;return null}const Ai=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ig=i=>!Sr(i)&&i!==Ai;function pl(){const{caseless:i}=ig(this)&&this||{},e={},t=(s,r)=>{const n=i&&tg(e,r)||r;wn(e[n])&&wn(s)?e[n]=pl(e[n],s):wn(s)?e[n]=pl({},s):ks(s)?e[n]=s.slice():e[n]=s};for(let s=0,r=arguments.length;s(Rr(e,(r,n)=>{t&&Je(r)?i[n]=Qm(r,t):i[n]=r},{allOwnKeys:s}),i),Yx=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),Qx=(i,e,t,s)=>{i.prototype=Object.create(e.prototype,s),i.prototype.constructor=i,Object.defineProperty(i,"super",{value:e.prototype}),t&&Object.assign(i.prototype,t)},Jx=(i,e,t,s)=>{let r,n,a;const o={};if(e=e||{},i==null)return e;do{for(r=Object.getOwnPropertyNames(i),n=r.length;n-- >0;)a=r[n],(!s||s(a,i,e))&&!o[a]&&(e[a]=i[a],o[a]=!0);i=t!==!1&&vu(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},Zx=(i,e,t)=>{i=String(i),(t===void 0||t>i.length)&&(t=i.length),t-=e.length;const s=i.indexOf(e,t);return s!==-1&&s===t},eE=i=>{if(!i)return null;if(ks(i))return i;let e=i.length;if(!eg(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},tE=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&vu(Uint8Array)),iE=(i,e)=>{const s=(i&&i[Oa]).call(i);let r;for(;(r=s.next())&&!r.done;){const n=r.value;e.call(i,n[0],n[1])}},sE=(i,e)=>{let t;const s=[];for(;(t=i.exec(e))!==null;)s.push(t);return s},rE=vt("HTMLFormElement"),nE=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,s,r){return s.toUpperCase()+r}),th=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),aE=vt("RegExp"),sg=(i,e)=>{const t=Object.getOwnPropertyDescriptors(i),s={};Rr(t,(r,n)=>{let a;(a=e(r,n,i))!==!1&&(s[n]=a||r)}),Object.defineProperties(i,s)},oE=i=>{sg(i,(e,t)=>{if(Je(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const s=i[t];if(Je(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},lE=(i,e)=>{const t={},s=r=>{r.forEach(n=>{t[n]=!0})};return ks(i)?s(i):s(String(i).split(e)),t},uE=()=>{},cE=(i,e)=>i!=null&&Number.isFinite(i=+i)?i:e;function dE(i){return!!(i&&Je(i.append)&&i[Jm]==="FormData"&&i[Oa])}const hE=i=>{const e=new Array(10),t=(s,r)=>{if(Na(s)){if(e.indexOf(s)>=0)return;if(!("toJSON"in s)){e[r]=s;const n=ks(s)?[]:{};return Rr(s,(a,o)=>{const u=t(a,r+1);!Sr(u)&&(n[o]=u)}),e[r]=void 0,n}}return s};return t(i,0)},fE=vt("AsyncFunction"),pE=i=>i&&(Na(i)||Je(i))&&Je(i.then)&&Je(i.catch),rg=((i,e)=>i?setImmediate:e?((t,s)=>(Ai.addEventListener("message",({source:r,data:n})=>{r===Ai&&n===t&&s.length&&s.shift()()},!1),r=>{s.push(r),Ai.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Je(Ai.postMessage)),mE=typeof queueMicrotask<"u"?queueMicrotask.bind(Ai):typeof process<"u"&&process.nextTick||rg,gE=i=>i!=null&&Je(i[Oa]),M={isArray:ks,isArrayBuffer:Zm,isBuffer:Lx,isFormData:jx,isArrayBufferView:Rx,isString:Nx,isNumber:eg,isBoolean:Mx,isObject:Na,isPlainObject:wn,isReadableStream:Vx,isRequest:zx,isResponse:Wx,isHeaders:Gx,isUndefined:Sr,isDate:Bx,isFile:Fx,isBlob:Ux,isRegExp:aE,isFunction:Je,isStream:$x,isURLSearchParams:Hx,isTypedArray:tE,isFileList:qx,forEach:Rr,merge:pl,extend:Kx,trim:Xx,stripBOM:Yx,inherits:Qx,toFlatObject:Jx,kindOf:La,kindOfTest:vt,endsWith:Zx,toArray:eE,forEachEntry:iE,matchAll:sE,isHTMLForm:rE,hasOwnProperty:th,hasOwnProp:th,reduceDescriptors:sg,freezeMethods:oE,toObjectSet:lE,toCamelCase:nE,noop:uE,toFiniteNumber:cE,findKey:tg,global:Ai,isContextDefined:ig,isSpecCompliantForm:dE,toJSONObject:hE,isAsyncFn:fE,isThenable:pE,setImmediate:rg,asap:mE,isIterable:gE};function Q(i,e,t,s,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=i,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),s&&(this.request=s),r&&(this.response=r,this.status=r.status?r.status:null)}M.inherits(Q,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:M.toJSONObject(this.config),code:this.code,status:this.status}}});const ng=Q.prototype,ag={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(i=>{ag[i]={value:i}});Object.defineProperties(Q,ag);Object.defineProperty(ng,"isAxiosError",{value:!0});Q.from=(i,e,t,s,r,n)=>{const a=Object.create(ng);return M.toFlatObject(i,a,function(u){return u!==Error.prototype},o=>o!=="isAxiosError"),Q.call(a,i.message,e,t,s,r),a.cause=i,a.name=i.name,n&&Object.assign(a,n),a};const yE=null;function ml(i){return M.isPlainObject(i)||M.isArray(i)}function og(i){return M.endsWith(i,"[]")?i.slice(0,-2):i}function ih(i,e,t){return i?i.concat(e).map(function(r,n){return r=og(r),!t&&n?"["+r+"]":r}).join(t?".":""):e}function _E(i){return M.isArray(i)&&!i.some(ml)}const TE=M.toFlatObject(M,{},null,function(e){return/^is[A-Z]/.test(e)});function Ma(i,e,t){if(!M.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=M.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(_,A){return!M.isUndefined(A[_])});const s=t.metaTokens,r=t.visitor||p,n=t.dots,a=t.indexes,u=(t.Blob||typeof Blob<"u"&&Blob)&&M.isSpecCompliantForm(e);if(!M.isFunction(r))throw new TypeError("visitor must be a function");function c(S){if(S===null)return"";if(M.isDate(S))return S.toISOString();if(M.isBoolean(S))return S.toString();if(!u&&M.isBlob(S))throw new Q("Blob is not supported. Use a Buffer instead.");return M.isArrayBuffer(S)||M.isTypedArray(S)?u&&typeof Blob=="function"?new Blob([S]):Buffer.from(S):S}function p(S,_,A){let D=S;if(S&&!A&&typeof S=="object"){if(M.endsWith(_,"{}"))_=s?_:_.slice(0,-2),S=JSON.stringify(S);else if(M.isArray(S)&&_E(S)||(M.isFileList(S)||M.endsWith(_,"[]"))&&(D=M.toArray(S)))return _=og(_),D.forEach(function(k,O){!(M.isUndefined(k)||k===null)&&e.append(a===!0?ih([_],O,n):a===null?_:_+"[]",c(k))}),!1}return ml(S)?!0:(e.append(ih(A,_,n),c(S)),!1)}const y=[],T=Object.assign(TE,{defaultVisitor:p,convertValue:c,isVisitable:ml});function x(S,_){if(!M.isUndefined(S)){if(y.indexOf(S)!==-1)throw Error("Circular reference detected in "+_.join("."));y.push(S),M.forEach(S,function(D,P){(!(M.isUndefined(D)||D===null)&&r.call(e,D,M.isString(P)?P.trim():P,_,T))===!0&&x(D,_?_.concat(P):[P])}),y.pop()}}if(!M.isObject(i))throw new TypeError("data must be an object");return x(i),e}function sh(i){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(s){return e[s]})}function Su(i,e){this._pairs=[],i&&Ma(i,this,e)}const lg=Su.prototype;lg.append=function(e,t){this._pairs.push([e,t])};lg.toString=function(e){const t=e?function(s){return e.call(this,s,sh)}:sh;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function bE(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ug(i,e,t){if(!e)return i;const s=t&&t.encode||bE;M.isFunction(t)&&(t={serialize:t});const r=t&&t.serialize;let n;if(r?n=r(e,t):n=M.isURLSearchParams(e)?e.toString():new Su(e,t).toString(s),n){const a=i.indexOf("#");a!==-1&&(i=i.slice(0,a)),i+=(i.indexOf("?")===-1?"?":"&")+n}return i}class rh{constructor(){this.handlers=[]}use(e,t,s){return this.handlers.push({fulfilled:e,rejected:t,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){M.forEach(this.handlers,function(s){s!==null&&e(s)})}}const cg={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},vE=typeof URLSearchParams<"u"?URLSearchParams:Su,SE=typeof FormData<"u"?FormData:null,xE=typeof Blob<"u"?Blob:null,EE={isBrowser:!0,classes:{URLSearchParams:vE,FormData:SE,Blob:xE},protocols:["http","https","file","blob","url","data"]},xu=typeof window<"u"&&typeof document<"u",gl=typeof navigator=="object"&&navigator||void 0,CE=xu&&(!gl||["ReactNative","NativeScript","NS"].indexOf(gl.product)<0),wE=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",AE=xu&&window.location.href||"http://localhost",DE=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:xu,hasStandardBrowserEnv:CE,hasStandardBrowserWebWorkerEnv:wE,navigator:gl,origin:AE},Symbol.toStringTag,{value:"Module"})),Re={...DE,...EE};function kE(i,e){return Ma(i,new Re.classes.URLSearchParams,Object.assign({visitor:function(t,s,r,n){return Re.isNode&&M.isBuffer(t)?(this.append(s,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},e))}function IE(i){return M.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}function PE(i){const e={},t=Object.keys(i);let s;const r=t.length;let n;for(s=0;s=t.length;return a=!a&&M.isArray(r)?r.length:a,u?(M.hasOwnProp(r,a)?r[a]=[r[a],s]:r[a]=s,!o):((!r[a]||!M.isObject(r[a]))&&(r[a]=[]),e(t,s,r[a],n)&&M.isArray(r[a])&&(r[a]=PE(r[a])),!o)}if(M.isFormData(i)&&M.isFunction(i.entries)){const t={};return M.forEachEntry(i,(s,r)=>{e(IE(s),r,t,0)}),t}return null}function OE(i,e,t){if(M.isString(i))try{return(e||JSON.parse)(i),M.trim(i)}catch(s){if(s.name!=="SyntaxError")throw s}return(t||JSON.stringify)(i)}const Nr={transitional:cg,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const s=t.getContentType()||"",r=s.indexOf("application/json")>-1,n=M.isObject(e);if(n&&M.isHTMLForm(e)&&(e=new FormData(e)),M.isFormData(e))return r?JSON.stringify(dg(e)):e;if(M.isArrayBuffer(e)||M.isBuffer(e)||M.isStream(e)||M.isFile(e)||M.isBlob(e)||M.isReadableStream(e))return e;if(M.isArrayBufferView(e))return e.buffer;if(M.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(n){if(s.indexOf("application/x-www-form-urlencoded")>-1)return kE(e,this.formSerializer).toString();if((o=M.isFileList(e))||s.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return Ma(o?{"files[]":e}:e,u&&new u,this.formSerializer)}}return n||r?(t.setContentType("application/json",!1),OE(e)):e}],transformResponse:[function(e){const t=this.transitional||Nr.transitional,s=t&&t.forcedJSONParsing,r=this.responseType==="json";if(M.isResponse(e)||M.isReadableStream(e))return e;if(e&&M.isString(e)&&(s&&!this.responseType||r)){const a=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(o){if(a)throw o.name==="SyntaxError"?Q.from(o,Q.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Re.classes.FormData,Blob:Re.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};M.forEach(["delete","get","head","post","put","patch"],i=>{Nr.headers[i]={}});const LE=M.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),RE=i=>{const e={};let t,s,r;return i&&i.split(` `).forEach(function(a){r=a.indexOf(":"),t=a.substring(0,r).trim().toLowerCase(),s=a.substring(r+1).trim(),!(!t||e[t]&&LE[t])&&(t==="set-cookie"?e[t]?e[t].push(s):e[t]=[s]:e[t]=e[t]?e[t]+", "+s:s)}),e},nh=Symbol("internals");function er(i){return i&&String(i).trim().toLowerCase()}function An(i){return i===!1||i==null?i:M.isArray(i)?i.map(An):String(i)}function NE(i){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=t.exec(i);)e[s[1]]=s[2];return e}const ME=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function Po(i,e,t,s,r){if(M.isFunction(s))return s.call(this,e,t);if(r&&(e=t),!!M.isString(e)){if(M.isString(s))return e.indexOf(s)!==-1;if(M.isRegExp(s))return s.test(e)}}function BE(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,s)=>t.toUpperCase()+s)}function FE(i,e){const t=M.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(i,s+t,{value:function(r,n,a){return this[s].call(this,e,r,n,a)},configurable:!0})})}let Ze=class{constructor(e){e&&this.set(e)}set(e,t,s){const r=this;function n(o,u,c){const p=er(u);if(!p)throw new Error("header name must be a non-empty string");const y=M.findKey(r,p);(!y||r[y]===void 0||c===!0||c===void 0&&r[y]!==!1)&&(r[y||u]=An(o))}const a=(o,u)=>M.forEach(o,(c,p)=>n(c,p,u));if(M.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(M.isString(e)&&(e=e.trim())&&!ME(e))a(RE(e),t);else if(M.isObject(e)&&M.isIterable(e)){let o={},u,c;for(const p of e){if(!M.isArray(p))throw TypeError("Object iterator must return a key-value pair");o[c=p[0]]=(u=o[c])?M.isArray(u)?[...u,p[1]]:[u,p[1]]:p[1]}a(o,t)}else e!=null&&n(t,e,s);return this}get(e,t){if(e=er(e),e){const s=M.findKey(this,e);if(s){const r=this[s];if(!t)return r;if(t===!0)return NE(r);if(M.isFunction(t))return t.call(this,r,s);if(M.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=er(e),e){const s=M.findKey(this,e);return!!(s&&this[s]!==void 0&&(!t||Po(this,this[s],s,t)))}return!1}delete(e,t){const s=this;let r=!1;function n(a){if(a=er(a),a){const o=M.findKey(s,a);o&&(!t||Po(s,s[o],o,t))&&(delete s[o],r=!0)}}return M.isArray(e)?e.forEach(n):n(e),r}clear(e){const t=Object.keys(this);let s=t.length,r=!1;for(;s--;){const n=t[s];(!e||Po(this,this[n],n,e,!0))&&(delete this[n],r=!0)}return r}normalize(e){const t=this,s={};return M.forEach(this,(r,n)=>{const a=M.findKey(s,n);if(a){t[a]=An(r),delete t[n];return}const o=e?BE(n):String(n).trim();o!==n&&delete t[n],t[o]=An(r),s[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return M.forEach(this,(s,r)=>{s!=null&&s!==!1&&(t[r]=e&&M.isArray(s)?s.join(", "):s)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(` `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const s=new this(e);return t.forEach(r=>s.set(r)),s}static accessor(e){const s=(this[nh]=this[nh]={accessors:{}}).accessors,r=this.prototype;function n(a){const o=er(a);s[o]||(FE(r,a),s[o]=!0)}return M.isArray(e)?e.forEach(n):n(e),this}};Ze.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);M.reduceDescriptors(Ze.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>i,set(s){this[t]=s}}});M.freezeMethods(Ze);function Oo(i,e){const t=this||Nr,s=e||t,r=Ze.from(s.headers);let n=s.data;return M.forEach(i,function(o){n=o.call(t,n,r.normalize(),e?e.status:void 0)}),r.normalize(),n}function hg(i){return!!(i&&i.__CANCEL__)}function Is(i,e,t){Q.call(this,i??"canceled",Q.ERR_CANCELED,e,t),this.name="CanceledError"}M.inherits(Is,Q,{__CANCEL__:!0});function fg(i,e,t){const s=t.config.validateStatus;!t.status||!s||s(t.status)?i(t):e(new Q("Request failed with status code "+t.status,[Q.ERR_BAD_REQUEST,Q.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function UE(i){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}function qE(i,e){i=i||10;const t=new Array(i),s=new Array(i);let r=0,n=0,a;return e=e!==void 0?e:1e3,function(u){const c=Date.now(),p=s[n];a||(a=c),t[r]=u,s[r]=c;let y=n,T=0;for(;y!==r;)T+=t[y++],y=y%i;if(r=(r+1)%i,r===n&&(n=(n+1)%i),c-a{t=p,r=null,n&&(clearTimeout(n),n=null),i.apply(null,c)};return[(...c)=>{const p=Date.now(),y=p-t;y>=s?a(c,p):(r=c,n||(n=setTimeout(()=>{n=null,a(r)},s-y)))},()=>r&&a(r)]}const ia=(i,e,t=3)=>{let s=0;const r=qE(50,250);return $E(n=>{const a=n.loaded,o=n.lengthComputable?n.total:void 0,u=a-s,c=r(u),p=a<=o;s=a;const y={loaded:a,total:o,progress:o?a/o:void 0,bytes:u,rate:c||void 0,estimated:c&&o&&p?(o-a)/c:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};i(y)},t)},ah=(i,e)=>{const t=i!=null;return[s=>e[0]({lengthComputable:t,total:i,loaded:s}),e[1]]},oh=i=>(...e)=>M.asap(()=>i(...e)),jE=Re.hasStandardBrowserEnv?((i,e)=>t=>(t=new URL(t,Re.origin),i.protocol===t.protocol&&i.host===t.host&&(e||i.port===t.port)))(new URL(Re.origin),Re.navigator&&/(msie|trident)/i.test(Re.navigator.userAgent)):()=>!0,HE=Re.hasStandardBrowserEnv?{write(i,e,t,s,r,n){const a=[i+"="+encodeURIComponent(e)];M.isNumber(t)&&a.push("expires="+new Date(t).toGMTString()),M.isString(s)&&a.push("path="+s),M.isString(r)&&a.push("domain="+r),n===!0&&a.push("secure"),document.cookie=a.join("; ")},read(i){const e=document.cookie.match(new RegExp("(^|;\\s*)("+i+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(i){this.write(i,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function VE(i){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function zE(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}function pg(i,e,t){let s=!VE(e);return i&&(s||t==!1)?zE(i,e):e}const lh=i=>i instanceof Ze?{...i}:i;function Bi(i,e){e=e||{};const t={};function s(c,p,y,T){return M.isPlainObject(c)&&M.isPlainObject(p)?M.merge.call({caseless:T},c,p):M.isPlainObject(p)?M.merge({},p):M.isArray(p)?p.slice():p}function r(c,p,y,T){if(M.isUndefined(p)){if(!M.isUndefined(c))return s(void 0,c,y,T)}else return s(c,p,y,T)}function n(c,p){if(!M.isUndefined(p))return s(void 0,p)}function a(c,p){if(M.isUndefined(p)){if(!M.isUndefined(c))return s(void 0,c)}else return s(void 0,p)}function o(c,p,y){if(y in e)return s(c,p);if(y in i)return s(void 0,c)}const u={url:n,method:n,data:n,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(c,p,y)=>r(lh(c),lh(p),y,!0)};return M.forEach(Object.keys(Object.assign({},i,e)),function(p){const y=u[p]||r,T=y(i[p],e[p],p);M.isUndefined(T)&&y!==o||(t[p]=T)}),t}const mg=i=>{const e=Bi({},i);let{data:t,withXSRFToken:s,xsrfHeaderName:r,xsrfCookieName:n,headers:a,auth:o}=e;e.headers=a=Ze.from(a),e.url=ug(pg(e.baseURL,e.url,e.allowAbsoluteUrls),i.params,i.paramsSerializer),o&&a.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):"")));let u;if(M.isFormData(t)){if(Re.hasStandardBrowserEnv||Re.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((u=a.getContentType())!==!1){const[c,...p]=u?u.split(";").map(y=>y.trim()).filter(Boolean):[];a.setContentType([c||"multipart/form-data",...p].join("; "))}}if(Re.hasStandardBrowserEnv&&(s&&M.isFunction(s)&&(s=s(e)),s||s!==!1&&jE(e.url))){const c=r&&n&&HE.read(n);c&&a.set(r,c)}return e},WE=typeof XMLHttpRequest<"u",GE=WE&&function(i){return new Promise(function(t,s){const r=mg(i);let n=r.data;const a=Ze.from(r.headers).normalize();let{responseType:o,onUploadProgress:u,onDownloadProgress:c}=r,p,y,T,x,S;function _(){x&&x(),S&&S(),r.cancelToken&&r.cancelToken.unsubscribe(p),r.signal&&r.signal.removeEventListener("abort",p)}let A=new XMLHttpRequest;A.open(r.method.toUpperCase(),r.url,!0),A.timeout=r.timeout;function D(){if(!A)return;const k=Ze.from("getAllResponseHeaders"in A&&A.getAllResponseHeaders()),R={data:!o||o==="text"||o==="json"?A.responseText:A.response,status:A.status,statusText:A.statusText,headers:k,config:i,request:A};fg(function(F){t(F),_()},function(F){s(F),_()},R),A=null}"onloadend"in A?A.onloadend=D:A.onreadystatechange=function(){!A||A.readyState!==4||A.status===0&&!(A.responseURL&&A.responseURL.indexOf("file:")===0)||setTimeout(D)},A.onabort=function(){A&&(s(new Q("Request aborted",Q.ECONNABORTED,i,A)),A=null)},A.onerror=function(){s(new Q("Network Error",Q.ERR_NETWORK,i,A)),A=null},A.ontimeout=function(){let O=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const R=r.transitional||cg;r.timeoutErrorMessage&&(O=r.timeoutErrorMessage),s(new Q(O,R.clarifyTimeoutError?Q.ETIMEDOUT:Q.ECONNABORTED,i,A)),A=null},n===void 0&&a.setContentType(null),"setRequestHeader"in A&&M.forEach(a.toJSON(),function(O,R){A.setRequestHeader(R,O)}),M.isUndefined(r.withCredentials)||(A.withCredentials=!!r.withCredentials),o&&o!=="json"&&(A.responseType=r.responseType),c&&([T,S]=ia(c,!0),A.addEventListener("progress",T)),u&&A.upload&&([y,x]=ia(u),A.upload.addEventListener("progress",y),A.upload.addEventListener("loadend",x)),(r.cancelToken||r.signal)&&(p=k=>{A&&(s(!k||k.type?new Is(null,i,A):k),A.abort(),A=null)},r.cancelToken&&r.cancelToken.subscribe(p),r.signal&&(r.signal.aborted?p():r.signal.addEventListener("abort",p)));const P=UE(r.url);if(P&&Re.protocols.indexOf(P)===-1){s(new Q("Unsupported protocol "+P+":",Q.ERR_BAD_REQUEST,i));return}A.send(n||null)})},XE=(i,e)=>{const{length:t}=i=i?i.filter(Boolean):[];if(e||t){let s=new AbortController,r;const n=function(c){if(!r){r=!0,o();const p=c instanceof Error?c:this.reason;s.abort(p instanceof Q?p:new Is(p instanceof Error?p.message:p))}};let a=e&&setTimeout(()=>{a=null,n(new Q(`timeout ${e} of ms exceeded`,Q.ETIMEDOUT))},e);const o=()=>{i&&(a&&clearTimeout(a),a=null,i.forEach(c=>{c.unsubscribe?c.unsubscribe(n):c.removeEventListener("abort",n)}),i=null)};i.forEach(c=>c.addEventListener("abort",n));const{signal:u}=s;return u.unsubscribe=()=>M.asap(o),u}},KE=function*(i,e){let t=i.byteLength;if(t{const r=YE(i,e);let n=0,a,o=u=>{a||(a=!0,s&&s(u))};return new ReadableStream({async pull(u){try{const{done:c,value:p}=await r.next();if(c){o(),u.close();return}let y=p.byteLength;if(t){let T=n+=y;t(T)}u.enqueue(new Uint8Array(p))}catch(c){throw o(c),c}},cancel(u){return o(u),r.return()}},{highWaterMark:2})},Ba=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",gg=Ba&&typeof ReadableStream=="function",JE=Ba&&(typeof TextEncoder=="function"?(i=>e=>i.encode(e))(new TextEncoder):async i=>new Uint8Array(await new Response(i).arrayBuffer())),yg=(i,...e)=>{try{return!!i(...e)}catch{return!1}},ZE=gg&&yg(()=>{let i=!1;const e=new Request(Re.origin,{body:new ReadableStream,method:"POST",get duplex(){return i=!0,"half"}}).headers.has("Content-Type");return i&&!e}),ch=64*1024,yl=gg&&yg(()=>M.isReadableStream(new Response("").body)),sa={stream:yl&&(i=>i.body)};Ba&&(i=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!sa[e]&&(sa[e]=M.isFunction(i[e])?t=>t[e]():(t,s)=>{throw new Q(`Response type '${e}' is not supported`,Q.ERR_NOT_SUPPORT,s)})})})(new Response);const eC=async i=>{if(i==null)return 0;if(M.isBlob(i))return i.size;if(M.isSpecCompliantForm(i))return(await new Request(Re.origin,{method:"POST",body:i}).arrayBuffer()).byteLength;if(M.isArrayBufferView(i)||M.isArrayBuffer(i))return i.byteLength;if(M.isURLSearchParams(i)&&(i=i+""),M.isString(i))return(await JE(i)).byteLength},tC=async(i,e)=>{const t=M.toFiniteNumber(i.getContentLength());return t??eC(e)},iC=Ba&&(async i=>{let{url:e,method:t,data:s,signal:r,cancelToken:n,timeout:a,onDownloadProgress:o,onUploadProgress:u,responseType:c,headers:p,withCredentials:y="same-origin",fetchOptions:T}=mg(i);c=c?(c+"").toLowerCase():"text";let x=XE([r,n&&n.toAbortSignal()],a),S;const _=x&&x.unsubscribe&&(()=>{x.unsubscribe()});let A;try{if(u&&ZE&&t!=="get"&&t!=="head"&&(A=await tC(p,s))!==0){let R=new Request(e,{method:"POST",body:s,duplex:"half"}),q;if(M.isFormData(s)&&(q=R.headers.get("content-type"))&&p.setContentType(q),R.body){const[F,$]=ah(A,ia(oh(u)));s=uh(R.body,ch,F,$)}}M.isString(y)||(y=y?"include":"omit");const D="credentials"in Request.prototype;S=new Request(e,{...T,signal:x,method:t.toUpperCase(),headers:p.normalize().toJSON(),body:s,duplex:"half",credentials:D?y:void 0});let P=await fetch(S,T);const k=yl&&(c==="stream"||c==="response");if(yl&&(o||k&&_)){const R={};["status","statusText","headers"].forEach(X=>{R[X]=P[X]});const q=M.toFiniteNumber(P.headers.get("content-length")),[F,$]=o&&ah(q,ia(oh(o),!0))||[];P=new Response(uh(P.body,ch,F,()=>{$&&$(),_&&_()}),R)}c=c||"text";let O=await sa[M.findKey(sa,c)||"text"](P,i);return!k&&_&&_(),await new Promise((R,q)=>{fg(R,q,{data:O,headers:Ze.from(P.headers),status:P.status,statusText:P.statusText,config:i,request:S})})}catch(D){throw _&&_(),D&&D.name==="TypeError"&&/Load failed|fetch/i.test(D.message)?Object.assign(new Q("Network Error",Q.ERR_NETWORK,i,S),{cause:D.cause||D}):Q.from(D,D&&D.code,i,S)}}),_l={http:yE,xhr:GE,fetch:iC};M.forEach(_l,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});const dh=i=>`- ${i}`,sC=i=>M.isFunction(i)||i===null||i===!1,_g={getAdapter:i=>{i=M.isArray(i)?i:[i];const{length:e}=i;let t,s;const r={};for(let n=0;n`adapter ${o} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=e?n.length>1?`since : `+n.map(dh).join(` `):" "+dh(n[0]):"as no adapter specified";throw new Q("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s},adapters:_l};function Lo(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new Is(null,i)}function hh(i){return Lo(i),i.headers=Ze.from(i.headers),i.data=Oo.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),_g.getAdapter(i.adapter||Nr.adapter)(i).then(function(s){return Lo(i),s.data=Oo.call(i,i.transformResponse,s),s.headers=Ze.from(s.headers),s},function(s){return hg(s)||(Lo(i),s&&s.response&&(s.response.data=Oo.call(i,i.transformResponse,s.response),s.response.headers=Ze.from(s.response.headers))),Promise.reject(s)})}const Tg="1.10.0",Fa={};["object","boolean","number","function","string","symbol"].forEach((i,e)=>{Fa[i]=function(s){return typeof s===i||"a"+(e<1?"n ":" ")+i}});const fh={};Fa.transitional=function(e,t,s){function r(n,a){return"[Axios v"+Tg+"] Transitional option '"+n+"'"+a+(s?". "+s:"")}return(n,a,o)=>{if(e===!1)throw new Q(r(a," has been removed"+(t?" in "+t:"")),Q.ERR_DEPRECATED);return t&&!fh[a]&&(fh[a]=!0,console.warn(r(a," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(n,a,o):!0}};Fa.spelling=function(e){return(t,s)=>(console.warn(`${s} is likely a misspelling of ${e}`),!0)};function rC(i,e,t){if(typeof i!="object")throw new Q("options must be an object",Q.ERR_BAD_OPTION_VALUE);const s=Object.keys(i);let r=s.length;for(;r-- >0;){const n=s[r],a=e[n];if(a){const o=i[n],u=o===void 0||a(o,n,i);if(u!==!0)throw new Q("option "+n+" must be "+u,Q.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Q("Unknown option "+n,Q.ERR_BAD_OPTION)}}const Dn={assertOptions:rC,validators:Fa},Et=Dn.validators;let Li=class{constructor(e){this.defaults=e||{},this.interceptors={request:new rh,response:new rh}}async request(e,t){try{return await this._request(e,t)}catch(s){if(s instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const n=r.stack?r.stack.replace(/^.+\n/,""):"";try{s.stack?n&&!String(s.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(s.stack+=` `+n):s.stack=n}catch{}}throw s}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Bi(this.defaults,t);const{transitional:s,paramsSerializer:r,headers:n}=t;s!==void 0&&Dn.assertOptions(s,{silentJSONParsing:Et.transitional(Et.boolean),forcedJSONParsing:Et.transitional(Et.boolean),clarifyTimeoutError:Et.transitional(Et.boolean)},!1),r!=null&&(M.isFunction(r)?t.paramsSerializer={serialize:r}:Dn.assertOptions(r,{encode:Et.function,serialize:Et.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Dn.assertOptions(t,{baseUrl:Et.spelling("baseURL"),withXsrfToken:Et.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=n&&M.merge(n.common,n[t.method]);n&&M.forEach(["delete","get","head","post","put","patch","common"],S=>{delete n[S]}),t.headers=Ze.concat(a,n);const o=[];let u=!0;this.interceptors.request.forEach(function(_){typeof _.runWhen=="function"&&_.runWhen(t)===!1||(u=u&&_.synchronous,o.unshift(_.fulfilled,_.rejected))});const c=[];this.interceptors.response.forEach(function(_){c.push(_.fulfilled,_.rejected)});let p,y=0,T;if(!u){const S=[hh.bind(this),void 0];for(S.unshift.apply(S,o),S.push.apply(S,c),T=S.length,p=Promise.resolve(t);y{if(!s._listeners)return;let n=s._listeners.length;for(;n-- >0;)s._listeners[n](r);s._listeners=null}),this.promise.then=r=>{let n;const a=new Promise(o=>{s.subscribe(o),n=o}).then(r);return a.cancel=function(){s.unsubscribe(n)},a},e(function(n,a,o){s.reason||(s.reason=new Is(n,a,o),t(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=s=>{e.abort(s)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new bg(function(r){e=r}),cancel:e}}};function aC(i){return function(t){return i.apply(null,t)}}function oC(i){return M.isObject(i)&&i.isAxiosError===!0}const Tl={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Tl).forEach(([i,e])=>{Tl[e]=i});function vg(i){const e=new Li(i),t=Qm(Li.prototype.request,e);return M.extend(t,Li.prototype,e,{allOwnKeys:!0}),M.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return vg(Bi(i,r))},t}const we=vg(Nr);we.Axios=Li;we.CanceledError=Is;we.CancelToken=nC;we.isCancel=hg;we.VERSION=Tg;we.toFormData=Ma;we.AxiosError=Q;we.Cancel=we.CanceledError;we.all=function(e){return Promise.all(e)};we.spread=aC;we.isAxiosError=oC;we.mergeConfig=Bi;we.AxiosHeaders=Ze;we.formToJSON=i=>dg(M.isHTMLForm(i)?new FormData(i):i);we.getAdapter=_g.getAdapter;we.HttpStatusCode=Tl;we.default=we;const{Axios:fC,AxiosError:pC,CanceledError:mC,isCancel:gC,CancelToken:yC,VERSION:_C,all:TC,Cancel:bC,isAxiosError:vC,spread:SC,toFormData:xC,AxiosHeaders:EC,HttpStatusCode:CC,formToJSON:wC,getAdapter:AC,mergeConfig:DC}=we;/*! js-cookie v3.0.5 | MIT */function vn(i){for(var e=1;e"u")){a=vn({},e,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),r=encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var u in a)a[u]&&(o+="; "+u,a[u]!==!0&&(o+="="+a[u].split(";")[0]));return document.cookie=r+"="+i.write(n,r)+o}}function s(r){if(!(typeof document>"u"||arguments.length&&!r)){for(var n=document.cookie?document.cookie.split("; "):[],a={},o=0;o"u"&&(window.userId=randomString(16),ui.set("user",window.userId,{expires:365})),window.location.pathname!=="/upgrade-1"&&ui.remove("transcript"),window.App.sendEvent("page:load",{page:window.location.href})});window.addEventListener("modal:open",function(i){i.detail.modal==="transcriptModal"&&(ui.set("transcript","true",{expires:365}),window.App.sendEvent("transcript:open"))});window.addEventListener("modal:close",function(i){i.detail.modal==="transcriptModal"&&(ui.remove("transcript"),window.App.sendEvent("transcript:close"))});(function(){const i=document.querySelector("[data-popup-container]"),e=document.querySelector("[data-popup-hidden-content]"),t=document.querySelector("[data-icon-container]"),s=document.querySelector("[data-map-container]"),r=document.querySelector("[data-user-name]"),n=document.querySelector("[data-user-location]"),a=document.querySelector("[data-user-products]"),o=4e3,u=2e4,c=8e3,p=["Emma","Liam","Olivia","Noah","Ava","Isabella","Sophia","Mia","Jackson","Aiden","Lucas","Elijah","Harper","Charlotte","Amelia","Benjamin","William","James","Evelyn","Abigail"],y=["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland"],T=[i.getAttribute("data-prodname-7"),i.getAttribute("data-prodname-8"),i.getAttribute("data-prodname-9")];function x(){const O=p[Math.floor(Math.random()*p.length)],R=y[Math.floor(Math.random()*y.length)],q=T[Math.floor(Math.random()*T.length)];r.textContent=O,n.textContent=R,a.textContent=q}function S(O=!1){O&&x(),i.classList.toggle("animate-popup"),e.classList.toggle("animate-hidden-content"),t.classList.toggle("display-none"),s.classList.toggle("animate-map-container")}let _=null;function A(){clearInterval(_),_=setInterval(function(){S(!0),setTimeout(S,o)},Math.floor(Math.random()*(u-c+1)+c))}function D(){clearInterval(_)}const P=function(){let O=document.querySelectorAll("[data-package]"),R=!1;for(let q=0;q